diff options
Diffstat (limited to 'Tests/RunCMake/VS10ProjectUseDebugLibraries')
18 files changed, 139 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake new file mode 100644 index 0000000..2ab8960 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake @@ -0,0 +1,8 @@ +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +UseDebugLibraries_check(default "true" "false") +UseDebugLibraries_check(defaultCLR "true" "false") +UseDebugLibraries_check(defaultUtil "true" "false") +UseDebugLibraries_check(defaultRTL "true" "false") +UseDebugLibraries_check(ALL_BUILD "true" "false") +UseDebugLibraries_check(ZERO_CHECK "true" "false") diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt new file mode 100644 index 0000000..9d1b69e --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0091-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0091 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake new file mode 100644 index 0000000..d8142ee --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0091 OLD) +include(Default-CMP0162-NEW.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt new file mode 100644 index 0000000..392312d --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.29) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake new file mode 100644 index 0000000..b5e6fae --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake @@ -0,0 +1,8 @@ +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +UseDebugLibraries_check(default "true" "false") +UseDebugLibraries_check(defaultCLR "true" "false") +UseDebugLibraries_check(defaultUtil "true" "false") +UseDebugLibraries_check(defaultRTL "false" "false") +UseDebugLibraries_check(ALL_BUILD "true" "false") +UseDebugLibraries_check(ZERO_CHECK "true" "false") diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake new file mode 100644 index 0000000..be6869d --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0162 NEW) +include(Default-common.cmake) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake new file mode 100644 index 0000000..673144e --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake @@ -0,0 +1,8 @@ +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +UseDebugLibraries_check(default "" "") +UseDebugLibraries_check(defaultCLR "" "") +UseDebugLibraries_check(defaultUtil "" "") +UseDebugLibraries_check(defaultRTL "" "") +UseDebugLibraries_check(ALL_BUILD "" "") +UseDebugLibraries_check(ZERO_CHECK "" "") diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake new file mode 100644 index 0000000..7696944 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake @@ -0,0 +1,2 @@ +# Leave CMP0162 unset. +include(Default-common.cmake) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake new file mode 100644 index 0000000..6afcfb6 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake @@ -0,0 +1,10 @@ +set(CMAKE_CONFIGURATION_TYPES Debug Release) +enable_language(CXX) + +# Test several generator code paths covering different target types. +add_library(default empty.cxx) +add_library(defaultCLR empty.cxx) +set_property(TARGET defaultCLR PROPERTY COMMON_LANGUAGE_RUNTIME "") +add_library(defaultRTL empty.cxx) +set_property(TARGET defaultRTL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +add_custom_target(defaultUtil) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake new file mode 100644 index 0000000..832a7f3 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/Explicit-check-common.cmake) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake new file mode 100644 index 0000000..a5f8d4a --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0162 NEW) +include(Explicit-common.cmake) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake new file mode 100644 index 0000000..832a7f3 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/Explicit-check-common.cmake) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake new file mode 100644 index 0000000..1e60c52 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0162 OLD) +include(Explicit-common.cmake) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake new file mode 100644 index 0000000..385b798 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake @@ -0,0 +1,10 @@ +include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) + +UseDebugLibraries_check(empty "" "") +UseDebugLibraries_check(emptyCLR "" "") +UseDebugLibraries_check(emptyUtil "" "") +UseDebugLibraries_check(genex "true" "false") +UseDebugLibraries_check(genexCLR "true" "false") +UseDebugLibraries_check(genexUtil "true" "false") +UseDebugLibraries_check(ALL_BUILD "false" "false") +UseDebugLibraries_check(ZERO_CHECK "false" "false") diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake new file mode 100644 index 0000000..3433745 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake @@ -0,0 +1,20 @@ +set(CMAKE_CONFIGURATION_TYPES Debug Release) +enable_language(CXX) + +# An empty string suppresses generation of the setting. +set(CMAKE_VS_USE_DEBUG_LIBRARIES "") +add_library(empty empty.cxx) +add_library(emptyCLR empty.cxx) +set_property(TARGET emptyCLR PROPERTY COMMON_LANGUAGE_RUNTIME "") +add_custom_target(emptyUtil) + +# A generator expression can encode per-config values. +set(CMAKE_VS_USE_DEBUG_LIBRARIES "$<CONFIG:Debug>") +add_library(genex empty.cxx) +add_library(genexCLR empty.cxx) +set_property(TARGET genexCLR PROPERTY COMMON_LANGUAGE_RUNTIME "") +add_custom_target(genexUtil) + +# The last setting in the top-level directcory affects +# the builtin targets like ALL_BUILD and ZERO_CHECK. +set(CMAKE_VS_USE_DEBUG_LIBRARIES 0) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake new file mode 100644 index 0000000..57402eb --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.29) +include(RunCMake) + +run_cmake(CMP0091-OLD) +run_cmake(Default-CMP0162-NEW) +run_cmake(Default-CMP0162-WARN) +run_cmake(Explicit-CMP0162-NEW) +run_cmake(Explicit-CMP0162-OLD) diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake new file mode 100644 index 0000000..311c8a7 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake @@ -0,0 +1,42 @@ +cmake_policy(SET CMP0140 NEW) +function(UseDebugLibraries_check tgt udl_expect_debug udl_expect_release) + 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_udl_debug 0) + set(have_udl_release 0) + set(inConfig "") + + file(STRINGS "${vcProjectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES [[^ *<PropertyGroup Condition="'\$\(Configuration\)\|\$\(Platform\)'=='([^"|]+)\|[^"]+" Label="Configuration">.*$]]) + string(TOLOWER "${CMAKE_MATCH_1}" inConfig) + elseif(inConfig) + if(line MATCHES "^ *</PropertyGroup>.*$") + set(inConfig "") + elseif(line MATCHES "^ *<UseDebugLibraries>([^<>]+)</UseDebugLibraries>") + set(udl_actual "${CMAKE_MATCH_1}") + set(have_udl_${inConfig} 1) + if (NOT "${udl_expect_${inConfig}}" STREQUAL "") + if(NOT "${udl_actual}" STREQUAL "${udl_expect_${inConfig}}") + string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has ${inConfig} UseDebugLibraries '${udl_actual}', not '${udl_expect_${inConfig}}'.\n") + endif() + else() + string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has ${inConfig} UseDebugLibraries '${udl_actual}', but should not have one.\n") + endif() + unset(udl_actual) + endif() + endif() + endforeach() + + if(NOT have_udl_debug AND NOT "${udl_expect_debug}" STREQUAL "") + string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a debug UseDebugLibraries field, but should have one.\n") + endif() + if(NOT have_udl_release AND NOT "${udl_expect_release}" STREQUAL "") + string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a release UseDebugLibraries field, but should have one.\n") + endif() + return(PROPAGATE RunCMake_TEST_FAILED) +endfunction() diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx b/Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx |