summaryrefslogtreecommitdiffstats
path: root/Tests/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Module')
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt7
-rw-r--r--Tests/Module/WriteCompilerDetectionHeader/main.cpp12
2 files changed, 19 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()
diff --git a/Tests/Module/WriteCompilerDetectionHeader/main.cpp b/Tests/Module/WriteCompilerDetectionHeader/main.cpp
index 8b4ea52..b807ad5 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;