diff options
author | Brad King <brad.king@kitware.com> | 2014-06-10 09:17:43 -0400 |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-06-10 09:17:43 -0400 |
commit | 487b6ccdcd7612768d920050dd0b0b67cd32775f (patch) | |
tree | 92679bb17a59ebfa7a9533eb4da8580b39ceffa1 /Tests | |
parent | e0471ae2f93ef46461ff462bbc9e3be9b64c55ed (diff) | |
parent | ddec418a8f27e62ae9f37cd03d28a42eeaa1527f (diff) | |
download | cmake-487b6ccdcd7612768d920050dd0b0b67cd32775f.tar.gz |
Merge topic 'WriteCompilerDetectionHeader-compiler-versions'
ddec418a Features: Add compiler version support to WriteCompilerDetectionHeader.
b7029576 Project: Add configurable name for version computation macros.
78acaafe Project: Separate simulated compiler id from version detection.
567af1a5 WCDH: Issue a better message for version compatibility.
Diffstat (limited to 'Tests')
3 files changed, 24 insertions, 1 deletions
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index ab0ebc398c..645cc65244 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() diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp index 8b4ea52f47..b807ad5eb0 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/main.cpp +++ b/Tests/Module/WriteCompilerDetectionHeader/main.cpp @@ -13,6 +13,18 @@ #error cxx_variadic_templates expected availability did not match. #endif +#if !CHECK(VERSION_MAJOR) +#error Compiler major version did not match. +#endif + +#if !CHECK(VERSION_MINOR) +#error Compiler minor version did not match. +#endif + +#if !CHECK(VERSION_PATCH) +#error Compiler patch version did not match. +#endif + int main() { return 0; diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt index 842eb3ff49..8d4db34313 100644 --- a/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/OldVersion-stderr.txt @@ -1,5 +1,9 @@ CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\): - VERSION parameter too low. + VERSION compatibility for write_compiler_detection_header is set to 3.0, + which is too low. It must be set to at least 3.1.0. Either set the + VERSION parameter to the write_compiler_detection_header function, or + update your minimum required CMake version with the cmake_minimum_required + command. Call Stack \(most recent call first\): OldVersion.cmake:4 \(write_compiler_detection_header\) CMakeLists.txt:3 \(include\) |