diff --git a/CMP0207-NEW-all-result.txt b/CMP0207-NEW-all-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/CMP0207-NEW-all-result.txt @@ -0,0 +1 @@ +1 diff --git a/CMP0207-NEW-all-stderr.txt b/CMP0207-NEW-all-stderr.txt new file mode 100644 index 0000000000..4df852742e --- /dev/null +++ b/CMP0207-NEW-all-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at cmake_install\.cmake:[0-9]+ \(file\): + file Could not resolve runtime dependencies: + + [^ +]*test\.dll$ diff --git a/Help/command/file.rst b/Help/command/file.rst index ec21fae991..52725902c2 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -1122,6 +1122,8 @@ Handling Runtime Binaries The following arguments specify filters for including or excluding libraries to be resolved. See below for a full description of how they work. + Directory separators in file paths may be matched using forward + slashes unless policy :policy:`CMP0207` is not set to ``NEW``. ``PRE_INCLUDE_REGEXES ...`` List of pre-include regexes through which to filter the names of diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index a1a1cc557b..90b5e822bb 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -98,6 +98,7 @@ Policies Introduced by CMake 4.3 .. toctree:: :maxdepth: 1 + CMP0207: file(GET_RUNTIME_DEPENDENCIES) normalizes paths before matching. CMP0206: The CPack Archive Generator defaults to UID 0 and GID 0. CMP0205: file(CREATE_LINK) with COPY_ON_ERROR copies directory content. diff --git a/Help/policy/CMP0207.rst b/Help/policy/CMP0207.rst new file mode 100644 index 0000000000..b544bd2bdd --- /dev/null +++ b/Help/policy/CMP0207.rst @@ -0,0 +1,26 @@ +CMP0207 +------- + +.. versionadded:: 4.3 + +:command:`file(GET_RUNTIME_DEPENDENCIES)` normalizes paths before matching. + +The :command:`file(GET_RUNTIME_DEPENDENCIES)` and +:command:`install(RUNTIME_DEPENDENCY_SET)` commands support filtering +resolved dependencies using regular expressions matching their paths. +In CMake 4.2 and below, callers were responsible for matching both forward +and backward slashes as path separators on Windows, e.g., via ``[\/]``. +CMake 4.3 and above prefer to normalize paths to use forward slashes before +matching. This policy provides compaitiblity for projects that may have +been relying on matching backslashes only. + +The ``OLD`` behavior for this policy matches filters against paths that +may contain any combination of forward and backward slashes on Windows. +The ``NEW`` behavior for this policy to convert all paths to forward +slashes before matching filters. + +.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.3 +.. |WARNS_OR_DOES_NOT_WARN| replace:: warns +.. include:: include/STANDARD_ADVICE.rst + +.. include:: include/DEPRECATED.rst diff --git a/Help/release/dev/file-GET_RUNTIME_DEPENDENCIES-matching.rst b/Help/release/dev/file-GET_RUNTIME_DEPENDENCIES-matching.rst new file mode 100644 index 0000000000..9d89558d10 --- /dev/null +++ b/Help/release/dev/file-GET_RUNTIME_DEPENDENCIES-matching.rst @@ -0,0 +1,6 @@ +file-GET_RUNTIME_DEPENDENCIES-matching +-------------------------------------- + +* The :command:`file(GET_RUNTIME_DEPENDENCIES)` + and :command:`install(RUNTIME_DEPENDENCY_SET)` commands now normalize + paths before matching filters. See policy :policy:`CMP0207`. diff --git a/Source/cmBinUtilsLinker.cxx b/Source/cmBinUtilsLinker.cxx index 4cce6082f0..ae43557ec6 100644 --- a/Source/cmBinUtilsLinker.cxx +++ b/Source/cmBinUtilsLinker.cxx @@ -3,7 +3,14 @@ #include "cmBinUtilsLinker.h" +#include + +#include "cmCMakePath.h" +#include "cmMakefile.h" +#include "cmMessageType.h" +#include "cmPolicies.h" #include "cmRuntimeDependencyArchive.h" +#include "cmStringAlgorithms.h" cmBinUtilsLinker::cmBinUtilsLinker(cmRuntimeDependencyArchive* archive) : Archive(archive) @@ -14,3 +21,27 @@ void cmBinUtilsLinker::SetError(std::string const& e) { this->Archive->SetError(e); } + +void cmBinUtilsLinker::NormalizePath(std::string& path) const +{ + std::string normalizedPath = + cmCMakePath(path, cmCMakePath::auto_format).GenericString(); + + if (path == normalizedPath) { + return; + } + + cmPolicies::PolicyStatus policy = + this->Archive->GetMakefile()->GetPolicyStatus(cmPolicies::CMP0207); + if (policy == cmPolicies::WARN) { + this->Archive->GetMakefile()->IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0207), '\n', + "Path\n \"", path, + "\"\n" + "would be converted to\n \"", + normalizedPath, "\"\n")); + } else if (policy == cmPolicies::NEW) { + path = std::move(normalizedPath); + } +} diff --git a/Source/cmBinUtilsLinker.h b/Source/cmBinUtilsLinker.h index 5b4130976b..f093860bbc 100644 --- a/Source/cmBinUtilsLinker.h +++ b/Source/cmBinUtilsLinker.h @@ -24,4 +24,6 @@ protected: cmRuntimeDependencyArchive* Archive; void SetError(std::string const& e); + + void NormalizePath(std::string& path) const; }; diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx index cf338a9947..e3ea16c348 100644 --- a/Source/cmBinUtilsLinuxELFLinker.cxx +++ b/Source/cmBinUtilsLinuxELFLinker.cxx @@ -204,6 +204,7 @@ bool cmBinUtilsLinuxELFLinker::ResolveDependency( path = cmStrCat(searchPath, '/', name); if (cmSystemTools::PathExists(path) && FileHasArchitecture(path.c_str(), this->Machine)) { + this->NormalizePath(path); resolved = true; return true; } diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index 98673181c8..97dce1a154 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -170,6 +170,7 @@ bool cmBinUtilsMacOSMachOLinker::ResolveDependency( } else { resolved = true; path = name; + this->NormalizePath(path); } if (resolved && !cmSystemTools::FileIsFullPath(path)) { @@ -198,6 +199,7 @@ bool cmBinUtilsMacOSMachOLinker::ResolveExecutablePathDependency( return true; } + this->NormalizePath(path); resolved = true; return true; } @@ -220,6 +222,7 @@ bool cmBinUtilsMacOSMachOLinker::ResolveLoaderPathDependency( return true; } + this->NormalizePath(path); resolved = true; return true; } @@ -252,7 +255,7 @@ bool cmBinUtilsMacOSMachOLinker::ResolveRPathDependency( /* * paraphrasing @ben.boeckel: * if /b/libB.dylib is supposed to be used, - * /a/libbB.dylib will be found first if it exists. CMake tries to + * /a/libB.dylib will be found first if it exists. CMake tries to * sort rpath directories to avoid this, but sometimes there is no * right answer. * @@ -268,7 +271,9 @@ bool cmBinUtilsMacOSMachOLinker::ResolveRPathDependency( * so as long as this method's resolution guarantees priority * in that manner further checking should not be necessary? */ - path = searchFile; + path = std::move(searchFile); + + this->NormalizePath(path); resolved = true; return true; } diff --git a/Source/cmBinUtilsWindowsPELinker.cxx b/Source/cmBinUtilsWindowsPELinker.cxx index 70ddaf2b08..2864e300b7 100644 --- a/Source/cmBinUtilsWindowsPELinker.cxx +++ b/Source/cmBinUtilsWindowsPELinker.cxx @@ -155,6 +155,7 @@ bool cmBinUtilsWindowsPELinker::ResolveDependency(std::string const& name, for (auto const& searchPath : dirs) { path = cmStrCat(searchPath, '/', name); if (cmSystemTools::PathExists(path)) { + this->NormalizePath(path); resolved = true; return true; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 15267d04a6..47654b914f 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -247,7 +247,8 @@ void AddInstallRuntimeDependenciesGenerator( cmInstallGenerator::SelectMessageLevel(helper.Makefile), runtimeDependenciesArgsRef.GetExcludeFromAll() && (apple ? frameworkArgs.GetExcludeFromAll() : true), - helper.Makefile->GetBacktrace()); + helper.Makefile->GetBacktrace(), + helper.Makefile->GetPolicyStatus(cmPolicies::CMP0207)); helper.Makefile->AddInstallGenerator( std::move(getRuntimeDependenciesGenerator)); diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx index 0ba9f14434..4292f8ff30 100644 --- a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx +++ b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx @@ -19,6 +19,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmPolicies.h" #include "cmScriptGenerator.h" #include "cmStringAlgorithms.h" @@ -83,7 +84,8 @@ cmInstallGetRuntimeDependenciesGenerator:: std::vector postExcludeFiles, std::string libraryComponent, std::string frameworkComponent, bool noInstallRPath, char const* depsVar, char const* rpathPrefix, std::vector const& configurations, - MessageLevel message, bool exclude_from_all, cmListFileBacktrace backtrace) + MessageLevel message, bool exclude_from_all, cmListFileBacktrace backtrace, + cmPolicies::PolicyStatus policyStatusCMP0207) : cmInstallGenerator("", configurations, "", message, exclude_from_all, false, std::move(backtrace)) , RuntimeDependencySet(runtimeDependencySet) @@ -96,6 +98,7 @@ cmInstallGetRuntimeDependenciesGenerator:: , PostExcludeFiles(std::move(postExcludeFiles)) , LibraryComponent(std::move(libraryComponent)) , FrameworkComponent(std::move(frameworkComponent)) + , PolicyStatusCMP0207(policyStatusCMP0207) , NoInstallRPath(noInstallRPath) , DepsVar(depsVar) , RPathPrefix(rpathPrefix) @@ -141,6 +144,14 @@ void cmInstallGetRuntimeDependenciesGenerator::GenerateScriptForConfig( this->LocalGenerator->GetMakefile()->GetSafeDefinition( "CMAKE_INSTALL_NAME_TOOL"); + Indent inputIndent = indent; + if (this->PolicyStatusCMP0207 != cmPolicies::WARN) { + indent = indent.Next(); + os << inputIndent << "block(SCOPE_FOR POLICIES)\n" + << indent << "cmake_policy(SET CMP0207 " + << (this->PolicyStatusCMP0207 == cmPolicies::NEW ? "NEW" : "OLD") + << ")\n"; + } os << indent << "file(GET_RUNTIME_DEPENDENCIES\n" << indent << " RESOLVED_DEPENDENCIES_VAR " << this->DepsVar << '\n'; WriteFilesArgument(os, "EXECUTABLES"_s, @@ -204,4 +215,8 @@ void cmInstallGetRuntimeDependenciesGenerator::GenerateScriptForConfig( os << indent << " RPATH_PREFIX " << this->RPathPrefix << '\n'; } os << indent << " )\n"; + + if (this->PolicyStatusCMP0207 != cmPolicies::WARN) { + os << inputIndent << "endblock()\n"; + } } diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.h b/Source/cmInstallGetRuntimeDependenciesGenerator.h index 11b6d87c33..9670dcf147 100644 --- a/Source/cmInstallGetRuntimeDependenciesGenerator.h +++ b/Source/cmInstallGetRuntimeDependenciesGenerator.h @@ -7,6 +7,7 @@ #include #include "cmInstallGenerator.h" +#include "cmPolicies.h" class cmListFileBacktrace; class cmLocalGenerator; @@ -26,8 +27,8 @@ public: std::vector postExcludeFiles, std::string libraryComponent, std::string frameworkComponent, bool noInstallRPath, char const* depsVar, char const* rpathPrefix, std::vector const& configurations, - MessageLevel message, bool exclude_from_all, - cmListFileBacktrace backtrace); + MessageLevel message, bool exclude_from_all, cmListFileBacktrace backtrace, + cmPolicies::PolicyStatus policyStatusCMP0207); bool Compute(cmLocalGenerator* lg) override; @@ -48,6 +49,7 @@ private: std::vector PostExcludeFiles; std::string LibraryComponent; std::string FrameworkComponent; + cmPolicies::PolicyStatus PolicyStatusCMP0207; bool NoInstallRPath; char const* DepsVar; char const* RPathPrefix; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index bd4f1ab293..b52a3c8827 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -618,7 +618,10 @@ class cmMakefile; 3, 0, WARN) \ SELECT(POLICY, CMP0206, \ "The CPack Archive Generator defaults to UID 0 and GID 0.", 4, 3, 0, \ - WARN) + WARN) \ + SELECT(POLICY, CMP0207, \ + "file(GET_RUNTIME_DEPENDENCIES) normalizes paths before matching.", \ + 4, 3, 0, WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx index 1ee80b4cd8..998d306863 100644 --- a/Source/cmRuntimeDependencyArchive.cxx +++ b/Source/cmRuntimeDependencyArchive.cxx @@ -367,7 +367,7 @@ void cmRuntimeDependencyArchive::AddResolvedPath( break; } } - it->second.insert(path); + it->second.emplace(path); this->RPaths[path] = std::move(rpaths); } diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt index d1c4ff2f9d..4f6a95374c 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt @@ -1,4 +1,5 @@ set(CMAKE_SKIP_RPATH OFF) +cmake_policy(SET CMP0207 NEW) # Import targets from the install tree. include(${Import_BINARY_DIR}/../Root/install-RUNTIME_DEPENDENCY_SET/targets.cmake) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW.cmake new file mode 100644 index 0000000000..53bb192e6f --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0207 NEW) + +include("${CMAKE_CURRENT_LIST_DIR}/CMP0207-common.cmake") + +install(CODE [[ + if(results_old) + message(SEND_ERROR "Old dependencies are not empty: `${results_old}`") + endif() + + if(NOT results_new) + message(SEND_ERROR "New dependencies are empty: `${results_new}`") + endif() + ]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-OLD.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-OLD.cmake new file mode 100644 index 0000000000..c7e497d893 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-OLD.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0207 OLD) + +include("${CMAKE_CURRENT_LIST_DIR}/CMP0207-common.cmake") + +install(CODE [[ + if(NOT results_old) + message(SEND_ERROR "Old dependencies are empty: `${results_old}`") + endif() + + if(results_new) + message(SEND_ERROR "New dependencies are not empty: `${results_new}`") + endif() + ]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-WARN-all-stderr.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-WARN-all-stderr.txt new file mode 100644 index 0000000000..1d8f189780 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-WARN-all-stderr.txt @@ -0,0 +1,44 @@ +^CMake Warning \(dev\) at cmake_install\.cmake:[0-9]+ \(file\): + Policy CMP0207 is not set: file\(GET_RUNTIME_DEPENDENCIES\) normalizes paths + before matching\. Run "cmake --help-policy CMP0207" for policy details\. + Use the cmake_policy command to set the policy and suppress this warning\. + + Path + + "[^"]*test\.dll" + + would be converted to + + "[^"]*test\.dll" + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning \(dev\) at cmake_install\.cmake:[0-9]+ \(file\): + Policy CMP0207 is not set: file\(GET_RUNTIME_DEPENDENCIES\) normalizes paths + before matching\. Run "cmake --help-policy CMP0207" for policy details\. + Use the cmake_policy command to set the policy and suppress this warning\. + + Path + + "[^"]*test\.dll" + + would be converted to + + "[^"]*test\.dll" + +This warning is for project developers\. Use -Wno-dev to suppress it\. ++ +CMake Warning \(dev\) at cmake_install\.cmake:[0-9]+ \(file\): + Policy CMP0207 is not set: file\(GET_RUNTIME_DEPENDENCIES\) normalizes paths + before matching\. Run "cmake --help-policy CMP0207" for policy details\. + Use the cmake_policy command to set the policy and suppress this warning\. + + Path + + "[^"]*test\.dll" + + would be converted to + + "[^"]*test\.dll" + +This warning is for project developers\. Use -Wno-dev to suppress it\.$ diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-WARN.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-WARN.cmake new file mode 100644 index 0000000000..a5a5cc0f0f --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-WARN.cmake @@ -0,0 +1,12 @@ +# CMP0207 is unset +include("${CMAKE_CURRENT_LIST_DIR}/CMP0207-common.cmake") + +install(CODE [[ + if(NOT results_old) + message(SEND_ERROR "Old dependencies are empty: `${results_old}`") + endif() + + if(results_new) + message(SEND_ERROR "New dependencies are not empty: `${results_new}`") + endif() + ]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-common.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-common.cmake new file mode 100644 index 0000000000..4d916a5beb --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-common.cmake @@ -0,0 +1,93 @@ +enable_language(C) + +file(WRITE "${CMAKE_BINARY_DIR}/test.c" "__declspec(dllexport) void test(void) {}\n") +file(WRITE "${CMAKE_BINARY_DIR}/main.c" [[__declspec(dllimport) extern void test(void); + +int main(void) +{ + test(); + return 0; +} +]]) + +add_subdirectory(CMP0207-subdir) + +add_executable(exe "${CMAKE_BINARY_DIR}/main.c") +target_link_libraries(exe PRIVATE test) + +install(TARGETS test DESTINATION bin/lib1) + +install( + TARGETS exe + DESTINATION results_old + RUNTIME_DEPENDENCIES + DIRECTORIES "${CMAKE_BINARY_DIR}/root-all\\bin\\lib1" + PRE_INCLUDE_REGEXES "^(lib)?test\\.dll$" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "\\\\lib1/(lib)?test\\.dll$" + POST_EXCLUDE_REGEXES ".*" +) + +install( + TARGETS exe + DESTINATION results_new + RUNTIME_DEPENDENCIES + DIRECTORIES "${CMAKE_BINARY_DIR}/root-all\\bin\\lib1" + PRE_INCLUDE_REGEXES "^(lib)?test\\.dll$" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "/lib1/(lib)?test\\.dll$" + POST_EXCLUDE_REGEXES ".*" +) + +install( + TARGETS exe + DESTINATION results_any + RUNTIME_DEPENDENCIES + DIRECTORIES "${CMAKE_BINARY_DIR}/root-all\\bin\\lib1" + PRE_INCLUDE_REGEXES "^(lib)?test\\.dll$" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "(\\\\|/)lib1/(lib)?test\\.dll$" + POST_EXCLUDE_REGEXES ".*" +) + +install( + TARGETS exe + DESTINATION results_any_forward + RUNTIME_DEPENDENCIES + DIRECTORIES "${CMAKE_BINARY_DIR}/root-all/bin/lib1" + PRE_INCLUDE_REGEXES "^(lib)?test\\.dll$" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "(\\\\|/)lib1/(lib)?test\\.dll$" + POST_EXCLUDE_REGEXES ".*" +) + +install( + CODE [[ + function(check_installed_lib directory out_var) + file(GLOB_RECURSE actual + LIST_DIRECTORIES FALSE + RELATIVE ${CMAKE_INSTALL_PREFIX}/${directory} + ${CMAKE_INSTALL_PREFIX}/${directory}/*.dll + ) + + if(actual) + list(SORT actual) + endif() + + set(${out_var} "${actual}" PARENT_SCOPE) + endfunction() + + check_installed_lib("results_old" results_old) + check_installed_lib("results_new" results_new) + check_installed_lib("results_any" results_any) + check_installed_lib("results_any_forward" results_any_forward) + + if(NOT results_any) + message(SEND_ERROR "Any dependencies are empty: `${results_any}`") + endif() + + if(NOT results_any_forward) + message(SEND_ERROR "Any forward dependencies are empty: `${results_any_forward}`") + endif() + ]] +) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-subdir/CMakeLists.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-subdir/CMakeLists.txt new file mode 100644 index 0000000000..8a1946cc42 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-subdir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(test SHARED "${CMAKE_BINARY_DIR}/test.c") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake index 55834070a6..88ed1bb648 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake @@ -49,6 +49,9 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") run_cmake(badargs1) run_cmake(badargs2) elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + run_install_test(CMP0207-OLD) + run_install_test(CMP0207-WARN) + run_install_test(CMP0207-NEW) run_install_test(windows) run_install_test(windows-unresolved) run_install_test(windows-conflict) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows.cmake index aad9077553..c45955fa7d 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows.cmake @@ -50,6 +50,7 @@ install(TARGETS topexe toplib topmod DESTINATION bin) install(CODE [[ function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile) + cmake_policy(SET CMP0207 NEW) file(GET_RUNTIME_DEPENDENCIES RESOLVED_DEPENDENCIES_VAR deps UNRESOLVED_DEPENDENCIES_VAR udeps diff --git a/b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW-all-result.txt b/b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW-all-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW-all-result.txt @@ -0,0 +1 @@ +1 diff --git a/b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW-all-stderr.txt b/b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW-all-stderr.txt new file mode 100644 index 0000000000..4df852742e --- /dev/null +++ b/b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/CMP0207-NEW-all-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at cmake_install\.cmake:[0-9]+ \(file\): + file Could not resolve runtime dependencies: + + [^ +]*test\.dll$