summaryrefslogtreecommitdiffstats
path: root/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-06-05 11:16:56 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-06-09 21:42:20 (GMT)
commitddec418a8f27e62ae9f37cd03d28a42eeaa1527f (patch)
treef36773a88e895389731ad39ce298de8641bed2b7 /Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
parentb70295760c22414ca80f51704ee1ab63872e0a7a (diff)
downloadCMake-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.txt7
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()