summaryrefslogtreecommitdiffstats
path: root/Tests/MSVCRuntimeLibrary
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-19 15:32:40 (GMT)
committerBrad King <brad.king@kitware.com>2019-04-22 12:48:44 (GMT)
commit61f70e81a708db126ba5e2d1135ff0e2a5ffba25 (patch)
treea740b4f4b8e7788b124a2c0a6a63048016dfee75 /Tests/MSVCRuntimeLibrary
parent8542152626590db6a13b20aa3d36214186c6b40d (diff)
downloadCMake-61f70e81a708db126ba5e2d1135ff0e2a5ffba25.zip
CMake-61f70e81a708db126ba5e2d1135ff0e2a5ffba25.tar.gz
CMake-61f70e81a708db126ba5e2d1135ff0e2a5ffba25.tar.bz2
MSVC: Document and test behavior of empty MSVC_RUNTIME_LIBRARY
Extend tests added by commit fb3370b6a1 (MSVC: Add abstraction for runtime library selection, 2019-04-10) to cover an empty value for the property. It should result in no specific setting. Issue: #19108
Diffstat (limited to 'Tests/MSVCRuntimeLibrary')
-rw-r--r--Tests/MSVCRuntimeLibrary/CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/MSVCRuntimeLibrary/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/CMakeLists.txt
index b7a6e86..6994d8d 100644
--- a/Tests/MSVCRuntimeLibrary/CMakeLists.txt
+++ b/Tests/MSVCRuntimeLibrary/CMakeLists.txt
@@ -42,7 +42,22 @@ endfunction()
function(verify lang src)
add_library(default-${lang} ${src})
target_compile_definitions(default-${lang} PRIVATE VERIFY_MT VERIFY_DLL "$<$<CONFIG:Debug>:VERIFY_DEBUG>")
+
verify_combinations(MultiThreaded ${lang} ${src})
+
+ # Test known MSVC default behavior when no flag is given.
+ if(CMAKE_${lang}_COMPILER_ID STREQUAL "MSVC")
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "")
+ add_library(empty-${lang} ${src})
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
+ # VS 2005 and above default to multi-threaded.
+ target_compile_definitions(empty-${lang} PRIVATE VERIFY_MT)
+ endif()
+ if(CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])")
+ # VS 2010 and above have a different default runtime library for projects than 'cl'.
+ target_compile_definitions(empty-${lang} PRIVATE VERIFY_DLL)
+ endif()
+ endif()
endfunction()
verify(C verify.c)