diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-06-05 11:16:56 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-06-09 21:42:20 (GMT) |
commit | ddec418a8f27e62ae9f37cd03d28a42eeaa1527f (patch) | |
tree | f36773a88e895389731ad39ce298de8641bed2b7 /Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | |
parent | b70295760c22414ca80f51704ee1ab63872e0a7a (diff) | |
download | CMake-ddec418a8f27e62ae9f37cd03d28a42eeaa1527f.zip CMake-ddec418a8f27e62ae9f37cd03d28a42eeaa1527f.tar.gz CMake-ddec418a8f27e62ae9f37cd03d28a42eeaa1527f.tar.bz2 |
Features: Add compiler version support to WriteCompilerDetectionHeader.
Diffstat (limited to 'Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt')
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index ab0ebc3..645cc65 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -35,6 +35,10 @@ if (NOT CMAKE_CXX_COMPILE_FEATURES AND NOT CMAKE_C_COMPILE_FEATURES) return() endif() +string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") +string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" COMPILER_VERSION_PATCH "${CMAKE_CXX_COMPILER_VERSION}") + macro(set_defines target true_defs false_defs) set(defines) foreach(def ${true_defs}) @@ -46,6 +50,9 @@ macro(set_defines target true_defs false_defs) target_compile_definitions(${target} PRIVATE ${defines} + EXPECTED_COMPILER_VERSION_MAJOR=${COMPILER_VERSION_MAJOR} + EXPECTED_COMPILER_VERSION_MINOR=${COMPILER_VERSION_MINOR} + EXPECTED_COMPILER_VERSION_PATCH=${COMPILER_VERSION_PATCH} ) endmacro() |