diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2016-12-12 13:52:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-15 14:16:30 (GMT) |
commit | 5c6c0344d32f9282059d46b6fe6f9925ac1f1202 (patch) | |
tree | fc9ce79ea985322807b73cbcd30bcc5cff5ce24d /Tests | |
parent | 3874843f0f5be9d53001517b3697e0d092f0e845 (diff) | |
download | CMake-5c6c0344d32f9282059d46b6fe6f9925ac1f1202.zip CMake-5c6c0344d32f9282059d46b6fe6f9925ac1f1202.tar.gz CMake-5c6c0344d32f9282059d46b6fe6f9925ac1f1202.tar.bz2 |
C# support: add compiler detection for MSVC
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeOnly/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/CMakeOnly/CompilerIdCSharp/CMakeLists.txt | 21 |
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() |