From dba647b56e868104a79cb361ba4dde2f3dd5ce21 Mon Sep 17 00:00:00 2001 From: Petr Zemek Date: Sun, 4 Feb 2018 08:46:37 +0100 Subject: [PATCH] Add more C++-standard-related CMake options to CMakeLists.txt. 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 https://github.com/avast-tl/retdec/issues/76 --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ced68e7..aaa5292 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") add_subdirectory(src)