aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-09-10 08:34:45 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-10 08:36:38 +0200
commit391eb9e5f35e3e0b80c84719b66872647ca15785 (patch)
tree1891d3bd2df4db13f2f096ad68954ecfb27783a1 /cmake
parent8ced74978b4afb8c779993b199fb58813637fe15 (diff)
downloadcmocka-391eb9e5f35e3e0b80c84719b66872647ca15785.tar.gz
cmocka-391eb9e5f35e3e0b80c84719b66872647ca15785.tar.xz
cmocka-391eb9e5f35e3e0b80c84719b66872647ca15785.zip
cmake: Move compiler flags to new file
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/AddCMockaTest.cmake26
-rw-r--r--cmake/Modules/DefineCompilerFlags.cmake25
2 files changed, 25 insertions, 26 deletions
diff --git a/cmake/Modules/AddCMockaTest.cmake b/cmake/Modules/AddCMockaTest.cmake
index e4197fe..db565fd 100644
--- a/cmake/Modules/AddCMockaTest.cmake
+++ b/cmake/Modules/AddCMockaTest.cmake
@@ -9,32 +9,6 @@
enable_testing()
include(CTest)
-if ((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang)") AND NOT MINGW)
- # Activate with: -DCMAKE_BUILD_TYPE=Profiling
- set(CMAKE_C_FLAGS_PROFILING "-g -O0 -fprofile-arcs -ftest-coverage"
- CACHE STRING "Flags used by the C compiler during PROFILING builds.")
- set(CMAKE_CXX_FLAGS_PROFILING "-g -O0 -fprofile-arcs -ftest-coverage"
- CACHE STRING "Flags used by the CXX compiler during PROFILING builds.")
- set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
- CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
- set(CMAKE_MODULE_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
- CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
- set(CMAKE_EXEC_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
- CACHE STRING "Flags used by the linker during PROFILING builds.")
-
- # Activate with: -DCMAKE_BUILD_TYPE=AddressSanitizer
- set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
- CACHE STRING "Flags used by the C compiler during ADDRESSSANITIZER builds.")
- set(CMAKE_CXX_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
- CACHE STRING "Flags used by the CXX compiler during ADDRESSSANITIZER builds.")
- set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
- CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
- set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
- CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
- set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
- CACHE STRING "Flags used by the linker during ADDRESSSANITIZER builds.")
-endif()
-
if (CMAKE_CROSSCOMPILING)
if (WIN32)
find_program(WINE_EXECUTABLE
diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake
new file mode 100644
index 0000000..98109dc
--- /dev/null
+++ b/cmake/Modules/DefineCompilerFlags.cmake
@@ -0,0 +1,25 @@
+if (UNIX AND NOT WIN32)
+ # Activate with: -DCMAKE_BUILD_TYPE=Profiling
+ set(CMAKE_C_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the C compiler during PROFILING builds.")
+ set(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the CXX compiler during PROFILING builds.")
+ set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
+ set(CMAKE_MODULE_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
+ set(CMAKE_EXEC_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the linker during PROFILING builds.")
+
+ # Activate with: -DCMAKE_BUILD_TYPE=AddressSanitizer
+ set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
+ CACHE STRING "Flags used by the C compiler during ADDRESSSANITIZER builds.")
+ set(CMAKE_CXX_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
+ CACHE STRING "Flags used by the CXX compiler during ADDRESSSANITIZER builds.")
+ set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
+ set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
+ set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
+ CACHE STRING "Flags used by the linker during ADDRESSSANITIZER builds.")
+endif()