From a12639e658e4c116728dd86c1ef227215303a9a2 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 28 May 2021 09:23:30 -0400 Subject: file(GET_RUNTIME_DEPENDENCIES): Add POST_{IN,EX}CLUDE_FILES arguments --- Help/command/file.rst | 32 +++++-- .../dev/get-runtime-dependencies-file-filter.rst | 5 + Source/cmFileCommand.cxx | 34 +++++-- Source/cmRuntimeDependencyArchive.cxx | 70 ++++++++------ Source/cmRuntimeDependencyArchive.h | 8 +- .../RunCMakeTest.cmake | 24 ++++- .../file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake | 2 + .../file-filter-all-check.cmake | 28 ++++++ .../file-filter.cmake | 104 +++++++++++++++++++++ .../linux-all-check.cmake | 18 ---- .../macos-all-check.cmake | 18 ---- .../windows-all-check.cmake | 18 ---- 12 files changed, 258 insertions(+), 103 deletions(-) create mode 100644 Help/release/dev/get-runtime-dependencies-file-filter.rst create mode 100644 Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake create mode 100644 Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake diff --git a/Help/command/file.rst b/Help/command/file.rst index f46e55a..761fcbc 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -179,6 +179,8 @@ the ```` and ``UTC`` options. [PRE_EXCLUDE_REGEXES [...]] [POST_INCLUDE_REGEXES [...]] [POST_EXCLUDE_REGEXES [...]] + [POST_INCLUDE_FILES [...]] + [POST_EXCLUDE_FILES [...]] ) .. versionadded:: 3.16 @@ -276,6 +278,18 @@ be resolved. See below for a full description of how they work. List of post-exclude regexes through which to filter the names of resolved dependencies. +``POST_INCLUDE_FILES `` + .. versionadded:: 3.21 + + List of post-include filenames through which to filter the names of resolved + dependencies. Symlinks are resolved when attempting to match these filenames. + +``POST_EXCLUDE_FILES `` + .. versionadded:: 3.21 + + List of post-exclude filenames through which to filter the names of resolved + dependencies. Symlinks are resolved when attempting to match these filenames. + These arguments can be used to exclude unwanted system libraries when resolving the dependencies, or to include libraries from a specific directory. The filtering works as follows: @@ -289,16 +303,18 @@ directory. The filtering works as follows: 4. ``file(GET_RUNTIME_DEPENDENCIES)`` searches for the dependency according to the linking rules of the platform (see below). 5. If the dependency is found, and its full path matches one of the - ``POST_INCLUDE_REGEXES``, the full path is added to the resolved - dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` recursively resolves - that library's own dependencies. Otherwise, resolution proceeds to step 6. + ``POST_INCLUDE_REGEXES`` or ``POST_INCLUDE_FILES``, the full path is added + to the resolved dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` + recursively resolves that library's own dependencies. Otherwise, resolution + proceeds to step 6. 6. If the dependency is found, but its full path matches one of the - ``POST_EXCLUDE_REGEXES``, it is not added to the resolved dependencies, and - dependency resolution stops for that dependency. + ``POST_EXCLUDE_REGEXES`` or ``POST_EXCLUDE_FILES``, it is not added to the + resolved dependencies, and dependency resolution stops for that dependency. 7. If the dependency is found, and its full path does not match either - ``POST_INCLUDE_REGEXES`` or ``POST_EXCLUDE_REGEXES``, the full path is added - to the resolved dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` - recursively resolves that library's own dependencies. + ``POST_INCLUDE_REGEXES``, ``POST_INCLUDE_FILES``, ``POST_EXCLUDE_REGEXES``, + or ``POST_EXCLUDE_FILES``, the full path is added to the resolved + dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` recursively resolves + that library's own dependencies. Different platforms have different rules for how dependencies are resolved. These specifics are described here. diff --git a/Help/release/dev/get-runtime-dependencies-file-filter.rst b/Help/release/dev/get-runtime-dependencies-file-filter.rst new file mode 100644 index 0000000..3fc17ac --- /dev/null +++ b/Help/release/dev/get-runtime-dependencies-file-filter.rst @@ -0,0 +1,5 @@ +get-runtime-dependencies-file-filter +------------------------------------ + +* The :command:`file(GET_RUNTIME_DEPENDENCIES)` command gained new + ``POST_INCLUDE_FILES`` and ``POST_EXCLUDE_FILES`` arguments. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 1088347..f2d4cda 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3041,6 +3041,9 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, std::vector PreExcludeRegexes; std::vector PostIncludeRegexes; std::vector PostExcludeRegexes; + std::vector PostIncludeFiles; + std::vector PostExcludeFiles; + std::vector PostExcludeFilesStrict; }; static auto const parser = @@ -3058,7 +3061,10 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, .Bind("PRE_INCLUDE_REGEXES"_s, &Arguments::PreIncludeRegexes) .Bind("PRE_EXCLUDE_REGEXES"_s, &Arguments::PreExcludeRegexes) .Bind("POST_INCLUDE_REGEXES"_s, &Arguments::PostIncludeRegexes) - .Bind("POST_EXCLUDE_REGEXES"_s, &Arguments::PostExcludeRegexes); + .Bind("POST_EXCLUDE_REGEXES"_s, &Arguments::PostExcludeRegexes) + .Bind("POST_INCLUDE_FILES"_s, &Arguments::PostIncludeFiles) + .Bind("POST_EXCLUDE_FILES"_s, &Arguments::PostExcludeFiles) + .Bind("POST_EXCLUDE_FILES_STRICT"_s, &Arguments::PostExcludeFilesStrict); std::vector unrecognizedArguments; std::vector keywordsMissingValues; @@ -3072,14 +3078,19 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, return false; } - const std::vector LIST_ARGS = { "DIRECTORIES", - "EXECUTABLES", - "LIBRARIES", - "MODULES", - "POST_EXCLUDE_REGEXES", - "POST_INCLUDE_REGEXES", - "PRE_EXCLUDE_REGEXES", - "PRE_INCLUDE_REGEXES" }; + const std::vector LIST_ARGS = { + "DIRECTORIES", + "EXECUTABLES", + "LIBRARIES", + "MODULES", + "POST_EXCLUDE_FILES", + "POST_EXCLUDE_FILES_STRICT", + "POST_EXCLUDE_REGEXES", + "POST_INCLUDE_FILES", + "POST_INCLUDE_REGEXES", + "PRE_EXCLUDE_REGEXES", + "PRE_INCLUDE_REGEXES", + }; auto kwbegin = keywordsMissingValues.cbegin(); auto kwend = cmRemoveMatching(keywordsMissingValues, LIST_ARGS); if (kwend != kwbegin) { @@ -3092,7 +3103,10 @@ bool HandleGetRuntimeDependenciesCommand(std::vector const& args, cmRuntimeDependencyArchive archive( status, parsedArgs.Directories, parsedArgs.BundleExecutable, parsedArgs.PreIncludeRegexes, parsedArgs.PreExcludeRegexes, - parsedArgs.PostIncludeRegexes, parsedArgs.PostExcludeRegexes); + parsedArgs.PostIncludeRegexes, parsedArgs.PostExcludeRegexes, + std::move(parsedArgs.PostIncludeFiles), + std::move(parsedArgs.PostExcludeFiles), + std::move(parsedArgs.PostExcludeFilesStrict)); if (!archive.Prepare()) { cmSystemTools::SetFatalErrorOccured(); return false; diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx index 472f234..a6ed523 100644 --- a/Source/cmRuntimeDependencyArchive.cxx +++ b/Source/cmRuntimeDependencyArchive.cxx @@ -115,7 +115,10 @@ cmRuntimeDependencyArchive::cmRuntimeDependencyArchive( const std::vector& preIncludeRegexes, const std::vector& preExcludeRegexes, const std::vector& postIncludeRegexes, - const std::vector& postExcludeRegexes) + const std::vector& postExcludeRegexes, + std::vector postIncludeFiles, + std::vector postExcludeFiles, + std::vector postExcludeFilesStrict) : Status(status) , SearchDirectories(std::move(searchDirectories)) , BundleExecutable(std::move(bundleExecutable)) @@ -123,6 +126,9 @@ cmRuntimeDependencyArchive::cmRuntimeDependencyArchive( , PreExcludeRegexes(preExcludeRegexes.size()) , PostIncludeRegexes(postIncludeRegexes.size()) , PostExcludeRegexes(postExcludeRegexes.size()) + , PostIncludeFiles(std::move(postIncludeFiles)) + , PostExcludeFiles(std::move(postExcludeFiles)) + , PostExcludeFilesStrict(std::move(postExcludeFilesStrict)) { std::transform(preIncludeRegexes.begin(), preIncludeRegexes.end(), this->PreIncludeRegexes.begin(), TransformCompile); @@ -306,39 +312,45 @@ bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand( bool cmRuntimeDependencyArchive::IsPreExcluded(const std::string& name) { cmsys::RegularExpressionMatch match; - - for (auto const& regex : this->PreIncludeRegexes) { - if (regex.find(name.c_str(), match)) { - return false; - } - } - - for (auto const& regex : this->PreExcludeRegexes) { - if (regex.find(name.c_str(), match)) { - return true; - } - } - - return false; + auto const regexMatch = + [&match, name](const cmsys::RegularExpression& regex) -> bool { + return regex.find(name.c_str(), match); + }; + auto const regexSearch = + [®exMatch]( + const std::vector& regexes) -> bool { + return std::any_of(regexes.begin(), regexes.end(), regexMatch); + }; + + return !regexSearch(this->PreIncludeRegexes) && + regexSearch(this->PreExcludeRegexes); } bool cmRuntimeDependencyArchive::IsPostExcluded(const std::string& name) { cmsys::RegularExpressionMatch match; - - for (auto const& regex : this->PostIncludeRegexes) { - if (regex.find(name.c_str(), match)) { - return false; - } - } - - for (auto const& regex : this->PostExcludeRegexes) { - if (regex.find(name.c_str(), match)) { - return true; - } - } - - return false; + auto const regexMatch = + [&match, name](const cmsys::RegularExpression& regex) -> bool { + return regex.find(name.c_str(), match); + }; + auto const regexSearch = + [®exMatch]( + const std::vector& regexes) -> bool { + return std::any_of(regexes.begin(), regexes.end(), regexMatch); + }; + auto const fileMatch = [name](const std::string& file) -> bool { + return cmSystemTools::SameFile(file, name); + }; + auto const fileSearch = + [&fileMatch](const std::vector& files) -> bool { + return std::any_of(files.begin(), files.end(), fileMatch); + }; + + return fileSearch(this->PostExcludeFilesStrict) || + (!(regexSearch(this->PostIncludeRegexes) || + fileSearch(this->PostIncludeFiles)) && + (regexSearch(this->PostExcludeRegexes) || + fileSearch(this->PostExcludeFiles))); } void cmRuntimeDependencyArchive::AddResolvedPath(const std::string& name, diff --git a/Source/cmRuntimeDependencyArchive.h b/Source/cmRuntimeDependencyArchive.h index 7f3b8e9..1dc3261 100644 --- a/Source/cmRuntimeDependencyArchive.h +++ b/Source/cmRuntimeDependencyArchive.h @@ -25,7 +25,10 @@ public: const std::vector& preIncludeRegexes, const std::vector& preExcludeRegexes, const std::vector& postIncludeRegexes, - const std::vector& postExcludeRegexes); + const std::vector& postExcludeRegexes, + std::vector postIncludeFiles, + std::vector postExcludeFiles, + std::vector postExcludeFilesStrict); bool Prepare(); bool GetRuntimeDependencies(const std::vector& executables, const std::vector& libraries, @@ -62,6 +65,9 @@ private: std::vector PreExcludeRegexes; std::vector PostIncludeRegexes; std::vector PostExcludeRegexes; + std::vector PostIncludeFiles; + std::vector PostExcludeFiles; + std::vector PostExcludeFilesStrict; std::map> ResolvedPaths; std::set UnresolvedPaths; }; diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake index 763d57c..c71b9ba 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake @@ -11,7 +11,26 @@ function(run_install_test case) run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug) # Check "all" components. set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-all) - run_cmake_command(${case}-all ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake) + run_cmake_command(${case}-all ${CMAKE_COMMAND} --install . --prefix ${CMAKE_INSTALL_PREFIX} --config Debug) +endfunction() + +# Function to check the contents of the output files. +function(check_contents filename contents_regex) + if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") + file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) + if(NOT contents MATCHES "${contents_regex}") + string(APPEND RunCMake_TEST_FAILED "File contents: + ${contents} +do not match what we expected: + ${contents_regex} +in file: + ${CMAKE_INSTALL_PREFIX}/${filename}\n") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) + endif() + else() + string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) + endif() endfunction() if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") @@ -20,6 +39,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") run_install_test(macos-unresolved) run_install_test(macos-conflict) run_install_test(macos-notfile) + run_install_test(file-filter) endif() run_cmake(project) run_cmake(badargs1) @@ -29,6 +49,7 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") run_install_test(windows-unresolved) run_install_test(windows-conflict) run_install_test(windows-notfile) + run_install_test(file-filter) run_cmake(project) run_cmake(badargs1) run_cmake(badargs2) @@ -41,6 +62,7 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") if(NOT CMAKE_C_COMPILER_ID MATCHES "^XL") run_install_test(linux) + run_install_test(file-filter) endif() run_install_test(linux-unresolved) run_install_test(linux-conflict) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake index ac6af85..f80829d 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/badargs2.cmake @@ -11,5 +11,7 @@ file(GET_RUNTIME_DEPENDENCIES PRE_EXCLUDE_REGEXES POST_INCLUDE_REGEXES POST_EXCLUDE_REGEXES + POST_INCLUDE_FILES + POST_EXCLUDE_FILES ) message(FATAL_ERROR "This message should not be displayed") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake new file mode 100644 index 0000000..9622f87 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-all-check.cmake @@ -0,0 +1,28 @@ +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") + set(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep1\.so]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep2\.so]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep3\.so]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep4\.so]] + ) + check_contents(deps/deps.txt "^${_check}$") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") + set(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep1\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep2\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep3\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/\.\./lib/libdep4\.dylib]] + ) + check_contents(deps/deps.txt "^${_check}$") +elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + set(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep1\.dll]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep2\.dll]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep3\.dll]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter-build/root-all/bin/(lib)?dep4\.dll]] + ) + check_contents(deps/deps.txt "^${_check}$") +endif() + +check_contents(deps/udeps.txt "^$") +check_contents(deps/cdeps.txt "^$") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake new file mode 100644 index 0000000..fef084b --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/file-filter.cmake @@ -0,0 +1,104 @@ +enable_language(C) + +set(dep_list) +set(import_list) +set(call_list) +foreach(i 1 2 3 4 5 6 7 8 9) + file(WRITE "${CMAKE_BINARY_DIR}/dep${i}.c" +"#ifdef _WIN32 +__declspec(dllexport) +#endif + void dep${i}(void) +{ +} +") + add_library(dep${i} SHARED "${CMAKE_BINARY_DIR}/dep${i}.c") + list(APPEND dep_list dep${i}) + string(APPEND import_list "EXE_IMPORT extern void dep${i}(void);\n") + string(APPEND call_list " dep${i}();\n") +endforeach() +set_target_properties(dep5 PROPERTIES + VERSION 1.2.3 + SOVERSION 1 + ) + +file(WRITE "${CMAKE_BINARY_DIR}/main.c" +"#ifdef _WIN32 +# define EXE_IMPORT __declspec(dllimport) +#else +# define EXE_IMPORT +#endif + +${import_list} +int main(void) +{ +${call_list} + return 0; +} +") + +add_executable(exe "${CMAKE_BINARY_DIR}/main.c") +target_link_libraries(exe PRIVATE ${dep_list}) + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set_property(TARGET exe PROPERTY INSTALL_RPATH "\${ORIGIN}/../lib") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_property(TARGET exe PROPERTY INSTALL_RPATH "@loader_path/../lib") +endif() + +install(TARGETS exe ${dep_list}) + +install(CODE + [[ + function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile) + file(GET_RUNTIME_DEPENDENCIES + RESOLVED_DEPENDENCIES_VAR deps + UNRESOLVED_DEPENDENCIES_VAR udeps + CONFLICTING_DEPENDENCIES_PREFIX cdeps + PRE_INCLUDE_REGEXES "dep[123456789]" + PRE_EXCLUDE_REGEXES ".*" + POST_INCLUDE_REGEXES "dep9" + POST_INCLUDE_FILES + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/../bin/$" + "${CMAKE_INSTALL_PREFIX}/bin/../lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + POST_EXCLUDE_FILES + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/../bin/$" + "${CMAKE_INSTALL_PREFIX}/bin/../lib/$" + POST_EXCLUDE_FILES_STRICT + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + "${CMAKE_INSTALL_PREFIX}/bin/$" + "${CMAKE_INSTALL_PREFIX}/lib/$" + ${ARGN} + ) + list(SORT deps) + list(SORT udeps) + list(SORT cdeps_FILENAMES) + file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${depsfile}" "${deps}") + file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${udepsfile}" "${udeps}") + file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "") + foreach(cdep IN LISTS cdeps_FILENAMES) + set(cdep_values ${cdeps_${cdep}}) + list(SORT cdep_values) + file(APPEND "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "${cdep}:${cdep_values}\n") + endforeach() + endfunction() + + exec_get_runtime_dependencies( + deps.txt udeps.txt cdeps.txt + EXECUTABLES + "${CMAKE_INSTALL_PREFIX}/bin/$" + ) + ]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake index 381b602..d3d1cd6 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-all-check.cmake @@ -1,21 +1,3 @@ -function(check_contents filename contents_regex) - if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") - file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) - if(NOT contents MATCHES "${contents_regex}") - string(APPEND RunCMake_TEST_FAILED "File contents: - ${contents} -do not match what we expected: - ${contents_regex} -in file: - ${CMAKE_INSTALL_PREFIX}/${filename}\n") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() - else() - string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() -endfunction() - set(_check [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-build/root-all/lib/libtest_rpath\.so]] [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/linux-build/root-all/lib/libtest_runpath\.so]] diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake index e7cdbf6..e9ff9f6 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake @@ -1,21 +1,3 @@ -function(check_contents filename contents_regex) - if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") - file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) - if(NOT contents MATCHES "${contents_regex}") - string(APPEND RunCMake_TEST_FAILED "File contents: - ${contents} -do not match what we expected: - ${contents_regex} -in file: - ${CMAKE_INSTALL_PREFIX}/${filename}\n") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() - else() - string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() -endfunction() - function(set_with_libsystem var) set(_tmp "${ARGN}") if(EXISTS "/usr/lib/libSystem.B.dylib") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake index f1d70a1..cb0e534 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake @@ -1,21 +1,3 @@ -function(check_contents filename contents_regex) - if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}") - file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents) - if(NOT contents MATCHES "${contents_regex}") - string(APPEND RunCMake_TEST_FAILED "File contents: - ${contents} -do not match what we expected: - ${contents_regex} -in file: - ${CMAKE_INSTALL_PREFIX}/${filename}\n") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() - else() - string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist") - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) - endif() -endfunction() - set(_check [=[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-build/root-all/bin/\.conflict/\.\./(lib)?libdir\.dll]=] [=[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-build/root-all/bin/\.search/(lib)?search\.dll]=] -- cgit v0.12