summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-16 13:26:06 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-12-16 13:26:06 (GMT)
commit4a06479874e583181f86fb64bf795e1eb1ee0de2 (patch)
tree594643ce8d9cd44439c5b81d3ad9e80aa88c1a52 /Tests
parent5c616c1089ea351336a7eefbf53ffb6e5bd8e97d (diff)
parent5c6c0344d32f9282059d46b6fe6f9925ac1f1202 (diff)
downloadCMake-4a06479874e583181f86fb64bf795e1eb1ee0de2.zip
CMake-4a06479874e583181f86fb64bf795e1eb1ee0de2.tar.gz
CMake-4a06479874e583181f86fb64bf795e1eb1ee0de2.tar.bz2
Merge topic 'csharp_support_compiler_detection'
5c6c0344 C# support: add compiler detection for MSVC
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt3
-rw-r--r--Tests/CMakeOnly/CompilerIdCSharp/CMakeLists.txt21
2 files changed, 24 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index 7586de6..c692cbd 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -26,6 +26,9 @@ add_CMakeOnly_test(CompilerIdCXX)
if(CMAKE_Fortran_COMPILER)
add_CMakeOnly_test(CompilerIdFortran)
endif()
+if(CMAKE_GENERATOR MATCHES "Visual Studio ([^789]|[789][0-9])")
+ add_CMakeOnly_test(CompilerIdCSharp)
+endif()
add_CMakeOnly_test(AllFindModules)
diff --git a/Tests/CMakeOnly/CompilerIdCSharp/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCSharp/CMakeLists.txt
new file mode 100644
index 0000000..6c07037
--- /dev/null
+++ b/Tests/CMakeOnly/CompilerIdCSharp/CMakeLists.txt
@@ -0,0 +1,21 @@
+cmake_minimum_required(VERSION 3.7.0)
+project(CompilerIdCSharp CSharp)
+
+foreach(v
+ CMAKE_CSharp_COMPILER
+ CMAKE_CSharp_COMPILER_ID
+ CMAKE_CSharp_COMPILER_VERSION
+ )
+ if(${v})
+ message(STATUS "${v}=[${${v}}]")
+ else()
+ message(SEND_ERROR "${v} not set!")
+ endif()
+endforeach()
+
+# Version numbers may only contain numbers and periods.
+if(NOT CMAKE_CSharp_COMPILER_VERSION MATCHES
+ "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$"
+ )
+ message(SEND_ERROR "Compiler version is not numeric!")
+endif()