summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Johnston <johnstonj.public@codenest.com>2015-12-03 21:17:26 (GMT)
committerJames Johnston <johnstonj.public@codenest.com>2015-12-03 21:37:07 (GMT)
commit25211d756fad353e96d29e289d40d780a5341c92 (patch)
treef9b79fe107c406d72f8003e7c743e5621616bc6f
parent060442c2e866c44ecf0c479e49e1d5ae35e8c6fb (diff)
downloadCMake-25211d756fad353e96d29e289d40d780a5341c92.zip
CMake-25211d756fad353e96d29e289d40d780a5341c92.tar.gz
CMake-25211d756fad353e96d29e289d40d780a5341c92.tar.bz2
Compiler ID: Compiler versions must be a valid, numeric version string.
This test helps catch errors in compiler identification.
-rw-r--r--Tests/CMakeOnly/CompilerIdC/CMakeLists.txt7
-rw-r--r--Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt7
-rw-r--r--Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt7
3 files changed, 21 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt
index 848ffdd..6fea73e 100644
--- a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt
+++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt
@@ -12,3 +12,10 @@ foreach(v
message(SEND_ERROR "${v} not set!")
endif()
endforeach()
+
+# Version numbers may only contain numbers and periods.
+if(NOT CMAKE_C_COMPILER_VERSION MATCHES
+ "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$"
+ )
+ message(SEND_ERROR "Compiler version is not numeric!")
+endif()
diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt
index 94ac31e..05e6bb2 100644
--- a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt
+++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt
@@ -12,3 +12,10 @@ foreach(v
message(SEND_ERROR "${v} not set!")
endif()
endforeach()
+
+# Version numbers may only contain numbers and periods.
+if(NOT CMAKE_CXX_COMPILER_VERSION MATCHES
+ "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$"
+ )
+ message(SEND_ERROR "Compiler version is not numeric!")
+endif()
diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt
index 02e4668..067fb8c 100644
--- a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt
+++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt
@@ -12,3 +12,10 @@ foreach(v
message(SEND_ERROR "${v} not set!")
endif()
endforeach()
+
+# Version numbers may only contain numbers and periods.
+if(NOT CMAKE_Fortran_COMPILER_VERSION MATCHES
+ "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$"
+ )
+ message(SEND_ERROR "Compiler version is not numeric!")
+endif()