Skip to content

Commit

Permalink
Add more C++-standard-related CMake options to CMakeLists.txt.
Browse files Browse the repository at this point in the history
set(CMAKE_CXX_STANDARD_REQUIRED ON)
This makes C++14 a requirement and prevents a "decay" to C++98 when the
compiler does not support C++14. RetDec and related tools require C++14 to
build, so the sooner the build fails the better.

set(CMAKE_CXX_EXTENSIONS OFF)
This disables the use of compiler-specific extensions. For example, by default,
CMake passes -std=gnu++14 to GCC on Linux. We want to build with -std=c++14 to
prevent use of non-portable compiler extensions, which is what the disabling of
this option does.

For more details, see avast/retdec#76
  • Loading branch information
s3rvac committed Feb 4, 2018
1 parent a79c3c2 commit cdec85d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if (NOT CMAKE_BUILD_TYPE)
endif()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

if(MSVC)
Expand Down

0 comments on commit cdec85d

Please sign in to comment.