summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeOnly
diff options
context:
space:
mode:
authorMichael Stürmer <michael.stuermer@schaeffler.com>2016-12-12 13:52:29 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-15 14:16:30 (GMT)
commit5c6c0344d32f9282059d46b6fe6f9925ac1f1202 (patch)
treefc9ce79ea985322807b73cbcd30bcc5cff5ce24d /Tests/CMakeOnly
parent3874843f0f5be9d53001517b3697e0d092f0e845 (diff)
downloadCMake-5c6c0344d32f9282059d46b6fe6f9925ac1f1202.zip
CMake-5c6c0344d32f9282059d46b6fe6f9925ac1f1202.tar.gz
CMake-5c6c0344d32f9282059d46b6fe6f9925ac1f1202.tar.bz2
C# support: add compiler detection for MSVC
Diffstat (limited to 'Tests/CMakeOnly')
-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()