From 721d8b192ad46b3b06ca4362838eed71db67830e Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 16 Feb 2024 12:42:37 -0500 Subject: VS: Add UseDebugLibraries to vcxproj files by default Use heuristics to select a reasonable value. Add policy CMP0162 to provide compatibility with existing projects. Fixes: #25327 --- Help/manual/cmake-policies.7.rst | 8 ++++ Help/policy/CMP0162.rst | 47 ++++++++++++++++++++++ Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst | 5 ++- Help/release/dev/vs-UseDebugLibraries.rst | 4 ++ Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst | 5 ++- Source/cmPolicies.h | 9 ++++- Source/cmVisualStudio10TargetGenerator.cxx | 13 ++++++ .../RunCMake/TargetPolicies/PolicyList-stderr.txt | 1 + .../CMP0091-OLD-check.cmake | 8 ++++ .../CMP0091-OLD-stderr.txt | 10 +++++ .../VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake | 2 + .../VS10ProjectUseDebugLibraries/CMakeLists.txt | 2 +- .../Default-CMP0162-NEW-check.cmake | 8 ++++ .../Default-CMP0162-NEW.cmake | 2 + .../Default-CMP0162-WARN-check.cmake | 8 ++++ .../Default-CMP0162-WARN.cmake | 2 + .../Default-check.cmake | 8 ---- .../Default-common.cmake | 10 +++++ .../VS10ProjectUseDebugLibraries/Default.cmake | 10 ----- .../Explicit-CMP0162-NEW-check.cmake | 1 + .../Explicit-CMP0162-NEW.cmake | 2 + .../Explicit-CMP0162-OLD-check.cmake | 1 + .../Explicit-CMP0162-OLD.cmake | 2 + .../Explicit-check-common.cmake | 10 +++++ .../Explicit-check.cmake | 10 ----- .../Explicit-common.cmake | 20 +++++++++ .../VS10ProjectUseDebugLibraries/Explicit.cmake | 20 --------- .../RunCMakeTest.cmake | 7 +++- 28 files changed, 178 insertions(+), 57 deletions(-) create mode 100644 Help/policy/CMP0162.rst create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake delete mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake delete mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Default.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake delete mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check.cmake create mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake delete mode 100644 Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit.cmake diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index bb6cfd4..ba74e68 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.30 +================================= + +.. toctree:: + :maxdepth: 1 + + CMP0162: Visual Studio generators add UseDebugLibraries indicators by default. + Policies Introduced by CMake 3.29 ================================= diff --git a/Help/policy/CMP0162.rst b/Help/policy/CMP0162.rst new file mode 100644 index 0000000..df46d96 --- /dev/null +++ b/Help/policy/CMP0162.rst @@ -0,0 +1,47 @@ +CMP0162 +------- + +.. versionadded:: 3.30 + +:ref:`Visual Studio Generators` add ``UseDebugLibraries`` indicators by default. + +The "Use Debug Libraries" setting in Visual Studio projects indicates what +configurations are considered debug configurations. In standalone projects, +this may affect MSBuild's default selection of MSVC runtime library, +optimization flags, runtime checks, and similar settings. CMake typically +generates all those settings explicitly based on the project's specification, +so CMake 3.29 and below do not write any ``UseDebugLibraries`` indicators to +``.vcxproj`` files. + +CMake 3.30 and above prefer to write ``UseDebugLibraries`` indicators because +they are useful for reference by both humans and tools, and may also affect +the behavior of platform-specific SDKs. The indicator for each configuration +of a target is determined as follows: + +* If the target compiles sources for a known MSVC runtime library + (such as that specified by :prop_tgt:`MSVC_RUNTIME_LIBRARY`), + then ``UseDebugLibraries`` is ``true`` for configurations that + compile for a "Debug" runtime library, and ``false`` for others. + +* Otherwise, such as in targets created by :command:`add_custom_target`, + ``UseDebugLibraries`` is ``true`` for the ``Debug`` configuration, + and ``false`` for others. + +This policy provides compatibility for projects that have not been updated to +expect the indicators. The policy setting is recorded by each target as it is +created and used to determine the default behavior for that target's +``.vcxproj`` file. + +The ``OLD`` behavior for this policy is to not generate ``UseDebugLibraries`` +indicators by default. The ``NEW`` behavior for this policy is to generate +``UseDebugLibraries`` indicators by default. + +If the :variable:`CMAKE_VS_USE_DEBUG_LIBRARIES` variable and/or +:prop_tgt:`VS_USE_DEBUG_LIBRARIES` target property is set, it explicitly +controls ``UseDebugLibraries`` generation regardless of this policy. + +.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30 +.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn +.. include:: STANDARD_ADVICE.txt + +.. include:: DEPRECATED.txt diff --git a/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst b/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst index 78ad36a..3d5ada4 100644 --- a/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst +++ b/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst @@ -23,5 +23,6 @@ to be non-debug configurations. The property is initialized from the value of the :variable:`CMAKE_VS_USE_DEBUG_LIBRARIES` variable, if it is set. -If the property is not set, then CMake does not generate any -``UseDebugLibraries`` indicator. +If the property is not set then CMake generates ``UseDebugLibraries`` using +heuristics to determine which configurations are debug configurations. +See policy :policy:`CMP0162`. diff --git a/Help/release/dev/vs-UseDebugLibraries.rst b/Help/release/dev/vs-UseDebugLibraries.rst index 477c385..b3774a9 100644 --- a/Help/release/dev/vs-UseDebugLibraries.rst +++ b/Help/release/dev/vs-UseDebugLibraries.rst @@ -1,6 +1,10 @@ vs-UseDebugLibraries -------------------- +* :ref:`Visual Studio Generators` now add ``UseDebugLibraries`` indicators to + ``.vcxproj`` files to denote which configurations are debug configurations. + See policy :policy:`CMP0162`. + * The :variable:`CMAKE_VS_USE_DEBUG_LIBRARIES` variable and corresponding :prop_tgt:`VS_USE_DEBUG_LIBRARIES` target property were added to explicitly control ``UseDebugLibraries`` indicators in ``.vcxproj`` files. diff --git a/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst b/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst index 45d3eff..35d94bc 100644 --- a/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst +++ b/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst @@ -24,5 +24,6 @@ property on all targets as they are created. It is also propagated by calls to the :command:`try_compile` command into its test project. If this variable is not set then the :prop_tgt:`VS_USE_DEBUG_LIBRARIES` -property will not be set automatically. If that property is not set -then CMake does not generate any ``UseDebugLibraries`` indicator. +property will not be set automatically. If that property is not set then +CMake generates ``UseDebugLibraries`` using heuristics to determine which +configurations are debug configurations. See policy :policy:`CMP0162`. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 705314f..6d86516 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -493,7 +493,11 @@ class cmMakefile; "More read-only target properties now error when trying to set them.", 3, \ 29, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0161, "CPACK_PRODUCTBUILD_DOMAINS defaults to true.", 3, \ - 29, 0, cmPolicies::WARN) + 29, 0, cmPolicies::WARN) \ + SELECT( \ + POLICY, CMP0162, \ + "Visual Studio generators add UseDebugLibraries indicators by default.", \ + 3, 30, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ @@ -536,7 +540,8 @@ class cmMakefile; F(CMP0155) \ F(CMP0156) \ F(CMP0157) \ - F(CMP0160) + F(CMP0160) \ + F(CMP0162) #define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \ F(CMP0116) \ diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 57ced36..579c0db 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1633,6 +1633,19 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesCommon( if (!useDebugLibraries.empty()) { maybeUseDebugLibraries = cmIsOn(useDebugLibraries); } + } else if (this->GeneratorTarget->GetPolicyStatusCMP0162() == + cmPolicies::NEW) { + // The project did not explicitly specify a value for this target. + // If the target compiles sources for a known MSVC runtime library, + // base our default value on that. + if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { + maybeUseDebugLibraries = this->ClOptions[config]->UsingDebugRuntime(); + } + // For other targets, such as UTILITY targets, base our default + // on the configuration name. + if (!maybeUseDebugLibraries) { + maybeUseDebugLibraries = cmSystemTools::UpperCase(config) == "DEBUG"_s; + } } if (maybeUseDebugLibraries) { if (*maybeUseDebugLibraries) { diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 6b462d0..415f404 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -42,6 +42,7 @@ \* CMP0156 \* CMP0157 \* CMP0160 + \* CMP0162 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) 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 index 94e43ba..392312d 100644 --- a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 3.29) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +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-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-check.cmake deleted file mode 100644 index 673144e..0000000 --- a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-check.cmake +++ /dev/null @@ -1,8 +0,0 @@ -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-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/Default.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default.cmake deleted file mode 100644 index 6afcfb6..0000000 --- a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default.cmake +++ /dev/null @@ -1,10 +0,0 @@ -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-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check.cmake deleted file mode 100644 index 385b798..0000000 --- a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check.cmake +++ /dev/null @@ -1,10 +0,0 @@ -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 "$") +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/Explicit.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit.cmake deleted file mode 100644 index 3433745..0000000 --- a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit.cmake +++ /dev/null @@ -1,20 +0,0 @@ -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 "$") -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 index 8db2028..57402eb 100644 --- a/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.29) include(RunCMake) -run_cmake(Default) -run_cmake(Explicit) +run_cmake(CMP0091-OLD) +run_cmake(Default-CMP0162-NEW) +run_cmake(Default-CMP0162-WARN) +run_cmake(Explicit-CMP0162-NEW) +run_cmake(Explicit-CMP0162-OLD) -- cgit v0.12