diff options
author | Richard Levitte <richard@levitte.org> | 2021-05-11 10:27:37 +0200 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@users.noreply.github.com> | 2021-05-11 13:59:56 +0300 |
commit | 5ad6c77686b906a7f137d0955400cc64f7b70c70 (patch) | |
tree | 9d671ffdb165d4609b5873f562c41751d1185b08 /CMakeLists.txt | |
parent | 7fec32136ce7c3a81cef7ad79a2e8f960a0097f1 (diff) | |
download | gost-engine-5ad6c77686b906a7f137d0955400cc64f7b70c70.zip gost-engine-5ad6c77686b906a7f137d0955400cc64f7b70c70.tar.gz gost-engine-5ad6c77686b906a7f137d0955400cc64f7b70c70.tar.bz2 |
Adapt C flags for the cmake build type
The C flags were set to be highly optimized regardless of the cmake
build type. This may make debugging difficult. To resolve that, we
adapt the C flags to the cmake build type in a supported manner.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5054f76..a6bb178 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,14 +15,20 @@ message("-- Found OpenSSL application: ${OPENSSL_PROGRAM}") include_directories(${OPENSSL_INCLUDE_DIR}) if (CMAKE_C_COMPILER_ID MATCHES "Clang") - add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Qunused-arguments -Wno-deprecated-declarations) + set(CMAKE_C_FLAGS_RELEASE -O2) + set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -ggdb") + add_compile_options(-Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Qunused-arguments -Wno-deprecated-declarations) elseif(CMAKE_C_COMPILER_ID MATCHES "GNU") - add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas -Wno-error=pragmas -Wno-deprecated-declarations) + set(CMAKE_C_FLAGS_RELEASE -O2) + set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -ggdb") + add_compile_options(-Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-error=unknown-pragmas -Wno-error=pragmas -Wno-deprecated-declarations) elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS) - add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) - add_compile_options(/MP /WX /W4 /wd4100 /wd4267 /wd4206 /wd4706 /wd4244 /wd4115) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS) + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) + add_compile_options(/MP /WX /W4 /wd4100 /wd4267 /wd4206 /wd4706 /wd4244 /wd4115) endif() if (ASAN) |