diff options
author | Brad King <brad.king@kitware.com> | 2019-04-17 15:01:03 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-04-17 15:01:37 (GMT) |
commit | 2ed688a863671d58513055ad56ab04d6be05295b (patch) | |
tree | 91c01b78176bf39f6058fe3b9c1676dbb57cbcad /Tests/RunCMake/VS10Project | |
parent | 5cd187147ecbd29a0afc5a6b49f2232b61a1ab8c (diff) | |
parent | fb3370b6a1681190ffd8daf63975c44ce8fc1c49 (diff) | |
download | CMake-2ed688a863671d58513055ad56ab04d6be05295b.zip CMake-2ed688a863671d58513055ad56ab04d6be05295b.tar.gz CMake-2ed688a863671d58513055ad56ab04d6be05295b.tar.bz2 |
Merge topic 'msvc-runtime-library'
fb3370b6a1 MSVC: Add abstraction for runtime library selection
f621e7fa5d VS: Fix Fortran runtime library flag map special case for '-' options
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Acked-by: Leonid Pospelov <pospelovlm@yandex.ru>
Merge-request: !3211
Diffstat (limited to 'Tests/RunCMake/VS10Project')
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake | 34 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/RuntimeLibrary.cmake | 16 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/empty.c | 0 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/empty.cxx | 0 |
5 files changed, 51 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 219e529..0ac589d 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) +run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(VsConfigurationType) diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake new file mode 100644 index 0000000..6b43d47 --- /dev/null +++ b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake @@ -0,0 +1,34 @@ +macro(RuntimeLibrary_check tgt rtl_expect) + set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj") + if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.") + return() + endif() + + set(HAVE_Runtimelibrary 0) + + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<RuntimeLibrary>([^<>]+)</RuntimeLibrary>") + set(rtl_actual "${CMAKE_MATCH_1}") + if(NOT "${rtl_actual}" STREQUAL "${rtl_expect}") + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has RuntimeLibrary '${rtl_actual}', not '${rtl_expect}'.") + return() + endif() + set(HAVE_Runtimelibrary 1) + break() + endif() + endforeach() + + if(NOT HAVE_Runtimelibrary) + set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a RuntimeLibrary field.") + return() + endif() +endmacro() + +RuntimeLibrary_check(default-C MultiThreadedDebugDLL) +RuntimeLibrary_check(default-CXX MultiThreadedDebugDLL) +RuntimeLibrary_check(MTd-C MultiThreadedDebug) +RuntimeLibrary_check(MTd-CXX MultiThreadedDebug) +RuntimeLibrary_check(MT-C MultiThreaded) +RuntimeLibrary_check(MT-CXX MultiThreaded) diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake new file mode 100644 index 0000000..6c77a25 --- /dev/null +++ b/Tests/RunCMake/VS10Project/RuntimeLibrary.cmake @@ -0,0 +1,16 @@ +set(CMAKE_CONFIGURATION_TYPES Debug) +cmake_policy(SET CMP0091 NEW) +enable_language(C) +enable_language(CXX) + +add_library(default-C empty.c) +add_library(default-CXX empty.cxx) + +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") +add_library(MTd-C empty.c) +add_library(MTd-CXX empty.cxx) + +add_library(MT-C empty.c) +set_property(TARGET MT-C PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") +add_library(MT-CXX empty.cxx) +set_property(TARGET MT-CXX PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded") diff --git a/Tests/RunCMake/VS10Project/empty.c b/Tests/RunCMake/VS10Project/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/VS10Project/empty.c diff --git a/Tests/RunCMake/VS10Project/empty.cxx b/Tests/RunCMake/VS10Project/empty.cxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/VS10Project/empty.cxx |