diff options
37 files changed, 375 insertions, 172 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 569f1e8..a053e59 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -338,6 +338,8 @@ will re-run whenever ``in.txt`` changes. where ``<config>`` is the build configuration, and then compile the generated source as part of a library. +.. _`add_custom_command(TARGET)`: + Build Events ^^^^^^^^^^^^ @@ -388,6 +390,9 @@ of the following is specified: This allows to add individual build events for every configuration. +.. versionadded:: 3.21 + Support for target-dependent generator expressions. + Examples: Build Events ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/command/file.rst b/Help/command/file.rst index f46e55a..b6ed416 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -116,7 +116,8 @@ Parse a list of ASCII strings from ``<filename>`` and store it in binary while reading unless this option is given. ``REGEX <regex>`` - Consider only strings that match the given regular expression. + Consider only strings that match the given regular expression, + as described under :ref:`string(REGEX) <Regex Specification>`. ``ENCODING <encoding-type>`` .. versionadded:: 3.1 @@ -179,6 +180,8 @@ the ``<format>`` and ``UTC`` options. [PRE_EXCLUDE_REGEXES [<regexes>...]] [POST_INCLUDE_REGEXES [<regexes>...]] [POST_EXCLUDE_REGEXES [<regexes>...]] + [POST_INCLUDE_FILES [<files>...]] + [POST_EXCLUDE_FILES [<files>...]] ) .. versionadded:: 3.16 @@ -276,6 +279,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 <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 <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 +304,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/command/install.rst b/Help/command/install.rst index 2865e1d..4d41fb3 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -573,7 +573,8 @@ any expression. For example, the code will extract and install header files from a source tree. -Some options may follow a ``PATTERN`` or ``REGEX`` expression and are applied +Some options may follow a ``PATTERN`` or ``REGEX`` expression as described +under :ref:`string(REGEX) <Regex Specification>` and are applied only to files or directories matching them. The ``EXCLUDE`` option will skip the matched file or directory. The ``PERMISSIONS`` option overrides the permissions setting for the matched file or directory. For diff --git a/Help/command/list.rst b/Help/command/list.rst index 7accc5a..f46641f 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -141,8 +141,8 @@ Appends elements to the list. Includes or removes items from the list that match the mode's pattern. In ``REGEX`` mode, items will be matched against the given regular expression. -For more information on regular expressions see also the -:command:`string` command. +For more information on regular expressions look under +:ref:`string(REGEX) <Regex Specification>`. .. _INSERT: diff --git a/Help/generator/Ninja Multi-Config.rst b/Help/generator/Ninja Multi-Config.rst index 8901192..e5ce4f5 100644 --- a/Help/generator/Ninja Multi-Config.rst +++ b/Help/generator/Ninja Multi-Config.rst @@ -34,7 +34,9 @@ below for how to enable cross-config mode. The ``Ninja Multi-Config`` generator recognizes the following variables: :variable:`CMAKE_CONFIGURATION_TYPES` - Specifies the total set of configurations to build. + Specifies the total set of configurations to build. Unlike with other + multi-config generators, this variable has a value of + ``Debug;Release;RelWithDebInfo`` by default. :variable:`CMAKE_CROSS_CONFIGS` Specifies a :ref:`semicolon-separated list <CMake Language Lists>` of diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst index 57c8ccf..0bcd691 100644 --- a/Help/manual/cmake-presets.7.rst +++ b/Help/manual/cmake-presets.7.rst @@ -642,7 +642,8 @@ that may contain the following fields: An optional string specifying a regex for test names. Equivalent to passing ``--tests-regex`` on the command line. This field supports - macro expansion. + macro expansion. CMake regex syntax is described under + :ref:`string(REGEX) <Regex Specification>`. ``label`` diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 811997c..72ef259 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -158,7 +158,8 @@ Options See `Show as JSON Object Model`_. ``-L <regex>, --label-regex <regex>`` - Run tests with labels matching regular expression. + Run tests with labels matching regular expression as described under + :ref:`string(REGEX) <Regex Specification>`. This option tells CTest to run only the tests whose labels match the given regular expression. When more than one ``-L`` option is given, diff --git a/Help/release/dev/add_custom_command-TARGET-genex.rst b/Help/release/dev/add_custom_command-TARGET-genex.rst new file mode 100644 index 0000000..86f8b36 --- /dev/null +++ b/Help/release/dev/add_custom_command-TARGET-genex.rst @@ -0,0 +1,5 @@ +add_custom_command-TARGET-genex +------------------------------- + +* The :ref:`add_custom_command(TARGET) <add_custom_command(TARGET)>` command + gained support for resolving target-dependent generator expressions. 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/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 9f93d41..7035d93 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -194,16 +194,25 @@ macro(__compiler_clang_cxx_standards lang) set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "") set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std:c++14") set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std:c++14") - if (CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) + + if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++17") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++17") - set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest") - set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest") else() set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++latest") endif() + if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) + set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std:c++latest") + set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++20") + set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++20") + elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) + set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest") + endif() + __compiler_check_default_language_standard(${lang} 3.9 14) else() # This version of clang-cl, or the MSVC version it simulates, does not have diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 1dfc760..f1c7450 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -18,6 +18,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11.25505) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) @@ -27,7 +28,13 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest") endif() - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835) + + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30129) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++20") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++20") + set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std:c++latest") + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835) set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest") endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 683e90d..7be1b9e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 20) -set(CMake_VERSION_PATCH 20210602) +set(CMake_VERSION_PATCH 20210603) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 3d7d031..57b1dda 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -289,6 +289,13 @@ int cmCTestCoverageHandler::ProcessHandler() this->CTest->GetCTestConfiguration("SourceDirectory"); std::string binaryDir = this->CTest->GetCTestConfiguration("BuildDirectory"); + if (binaryDir.empty()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Binary directory is not set. " + "No coverage checking will be performed." + << std::endl); + return 0; + } this->LoadLabels(); cmGeneratedFileStream ofs; diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index f6b9989..ec60ff7 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -150,3 +150,13 @@ void cmCustomCommand::SetCMP0116Status(cmPolicies::PolicyStatus cmp0116) { this->CMP0116Status = cmp0116; } + +const std::string& cmCustomCommand::GetTarget() const +{ + return this->Target; +} + +void cmCustomCommand::SetTarget(const std::string& target) +{ + this->Target = target; +} diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index e22c7a4..5cbd3d1 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -100,6 +100,10 @@ public: cmPolicies::PolicyStatus GetCMP0116Status() const; void SetCMP0116Status(cmPolicies::PolicyStatus cmp0116); + /** Set/Get the associated target */ + const std::string& GetTarget() const; + void SetTarget(const std::string& target); + private: std::vector<std::string> Outputs; std::vector<std::string> Byproducts; @@ -107,6 +111,7 @@ private: cmCustomCommandLines CommandLines; cmListFileBacktrace Backtrace; cmImplicitDependsList ImplicitDepends; + std::string Target; std::string Comment; std::string WorkingDirectory; std::string Depfile; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 1054beb..10a6491 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -29,7 +29,7 @@ namespace { std::string EvaluateSplitConfigGenex( cm::string_view input, cmGeneratorExpression const& ge, cmLocalGenerator* lg, bool useOutputConfig, std::string const& outputConfig, - std::string const& commandConfig, + std::string const& commandConfig, cmGeneratorTarget const* target, std::set<BT<std::pair<std::string, bool>>>* utils = nullptr) { std::string result; @@ -87,7 +87,7 @@ std::string EvaluateSplitConfigGenex( // Evaluate this genex in the selected configuration. std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(std::string(genex)); - result += cge->Evaluate(lg, *config); + result += cge->Evaluate(lg, *config, target); // Record targets referenced by the genex. if (utils) { @@ -114,7 +114,8 @@ std::vector<std::string> EvaluateDepends(std::vector<std::string> const& paths, std::string const& ep = EvaluateSplitConfigGenex(p, ge, lg, /*useOutputConfig=*/true, /*outputConfig=*/outputConfig, - /*commandConfig=*/commandConfig); + /*commandConfig=*/commandConfig, + /*target=*/nullptr); cm::append(depends, cmExpandedList(ep)); } for (std::string& p : depends) { @@ -157,6 +158,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( : CC(&cc) , OutputConfig(crossConfig ? *crossConfig : config) , CommandConfig(std::move(config)) + , Target(cc.GetTarget()) , LG(lg) , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) @@ -171,6 +173,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( } cmGeneratorExpression ge(cc.GetBacktrace()); + cmGeneratorTarget const* target{ lg->FindGeneratorTargetToUse( + this->Target) }; const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines(); for (cmCustomCommandLine const& cmdline : cmdlines) { @@ -180,7 +184,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( for (std::string const& clarg : cmdline) { std::string parsed_arg = EvaluateSplitConfigGenex( clarg, ge, this->LG, useOutputConfig, this->OutputConfig, - this->CommandConfig, &this->Utilities); + this->CommandConfig, target, &this->Utilities); if (this->CC->GetCommandExpandLists()) { cm::append(argv, cmExpandedList(parsed_arg)); } else { @@ -223,9 +227,6 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( case cmDepfileFormat::GccDepfile: argv.emplace_back("gccdepfile"); break; - case cmDepfileFormat::VsTlog: - argv.emplace_back("vstlog"); - break; case cmDepfileFormat::MakeDepfile: argv.emplace_back("makedepfile"); break; @@ -249,9 +250,9 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( const std::string& workingdirectory = this->CC->GetWorkingDirectory(); if (!workingdirectory.empty()) { - this->WorkingDirectory = - EvaluateSplitConfigGenex(workingdirectory, ge, this->LG, true, - this->OutputConfig, this->CommandConfig); + this->WorkingDirectory = EvaluateSplitConfigGenex( + workingdirectory, ge, this->LG, true, this->OutputConfig, + this->CommandConfig, target); // Convert working directory to a full path. if (!this->WorkingDirectory.empty()) { std::string const& build_dir = this->LG->GetCurrentBinaryDirectory(); @@ -436,9 +437,6 @@ std::string cmCustomCommandGenerator::GetInternalDepfileName( case cmDepfileFormat::MakeDepfile: extension = ".d"; break; - case cmDepfileFormat::VsTlog: - extension = ".tlog"; - break; } return cmStrCat(this->LG->GetBinaryDirectory(), "/CMakeFiles/d/", hash.HashString(depfile), extension); diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index e70909a..73a8d38 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -25,6 +25,7 @@ class cmCustomCommandGenerator cmCustomCommand const* CC; std::string OutputConfig; std::string CommandConfig; + std::string Target; cmLocalGenerator* LG; bool OldStyle; bool MakeVars; 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<std::string> const& args, std::vector<std::string> PreExcludeRegexes; std::vector<std::string> PostIncludeRegexes; std::vector<std::string> PostExcludeRegexes; + std::vector<std::string> PostIncludeFiles; + std::vector<std::string> PostExcludeFiles; + std::vector<std::string> PostExcludeFilesStrict; }; static auto const parser = @@ -3058,7 +3061,10 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> 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<std::string> unrecognizedArguments; std::vector<std::string> keywordsMissingValues; @@ -3072,14 +3078,19 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args, return false; } - const std::vector<std::string> LIST_ARGS = { "DIRECTORIES", - "EXECUTABLES", - "LIBRARIES", - "MODULES", - "POST_EXCLUDE_REGEXES", - "POST_INCLUDE_REGEXES", - "PRE_EXCLUDE_REGEXES", - "PRE_INCLUDE_REGEXES" }; + const std::vector<std::string> 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<std::string> 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/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0c686aa..6a49b84 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -4096,6 +4096,7 @@ void AddCustomCommandToTarget(cmLocalGenerator& lg, cc.SetDepfile(depfile); cc.SetJobPool(job_pool); cc.SetCMP0116Status(cmp0116); + cc.SetTarget(target->GetName()); switch (type) { case cmCustomCommandType::PRE_BUILD: target->AddPreBuildCommand(std::move(cc)); 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<std::string>& preIncludeRegexes, const std::vector<std::string>& preExcludeRegexes, const std::vector<std::string>& postIncludeRegexes, - const std::vector<std::string>& postExcludeRegexes) + const std::vector<std::string>& postExcludeRegexes, + std::vector<std::string> postIncludeFiles, + std::vector<std::string> postExcludeFiles, + std::vector<std::string> 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<cmsys::RegularExpression>& 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<cmsys::RegularExpression>& 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<std::string>& 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<std::string>& preIncludeRegexes, const std::vector<std::string>& preExcludeRegexes, const std::vector<std::string>& postIncludeRegexes, - const std::vector<std::string>& postExcludeRegexes); + const std::vector<std::string>& postExcludeRegexes, + std::vector<std::string> postIncludeFiles, + std::vector<std::string> postExcludeFiles, + std::vector<std::string> postExcludeFilesStrict); bool Prepare(); bool GetRuntimeDependencies(const std::vector<std::string>& executables, const std::vector<std::string>& libraries, @@ -62,6 +65,9 @@ private: std::vector<cmsys::RegularExpression> PreExcludeRegexes; std::vector<cmsys::RegularExpression> PostIncludeRegexes; std::vector<cmsys::RegularExpression> PostExcludeRegexes; + std::vector<std::string> PostIncludeFiles; + std::vector<std::string> PostExcludeFiles; + std::vector<std::string> PostExcludeFilesStrict; std::map<std::string, std::set<std::string>> ResolvedPaths; std::set<std::string> UnresolvedPaths; }; diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx index 6927300..0df9550 100644 --- a/Source/cmTransformDepfile.cxx +++ b/Source/cmTransformDepfile.cxx @@ -78,37 +78,6 @@ void WriteDepfile(cmDepfileFormat format, cmsys::ofstream& fout, } } } - -// tlog format : always windows paths on Windows regardless the generator -std::string ConvertToTLogOutputPath(const std::string& path) -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - return cmSystemTools::ConvertToWindowsOutputPath(path); -#else - return cmSystemTools::ConvertToOutputPath(path); -#endif -} - -void WriteVsTlog(cmsys::ofstream& fout, const cmLocalGenerator& lg, - const cmGccDepfileContent& content) -{ - for (auto const& dep : content) { - fout << '^'; - bool first = true; - for (auto const& rule : dep.rules) { - if (!first) { - fout << '|'; - } - first = false; - fout << ConvertToTLogOutputPath(lg.MaybeRelativeToTopBinDir(rule)); - } - fout << "\r\n"; - for (auto const& path : dep.paths) { - fout << ConvertToTLogOutputPath(lg.MaybeRelativeToTopBinDir(path)) - << "\r\n"; - } - } -} } bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg, @@ -133,9 +102,6 @@ bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg, case cmDepfileFormat::MakeDepfile: WriteDepfile(format, fout, lg, content); break; - case cmDepfileFormat::VsTlog: - WriteVsTlog(fout, lg, content); - break; } return true; } diff --git a/Source/cmTransformDepfile.h b/Source/cmTransformDepfile.h index c31e4ab..ce7cd66 100644 --- a/Source/cmTransformDepfile.h +++ b/Source/cmTransformDepfile.h @@ -7,7 +7,6 @@ enum class cmDepfileFormat { GccDepfile, - VsTlog, MakeDepfile }; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 727e412..84ac189 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1529,8 +1529,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, auto format = cmDepfileFormat::GccDepfile; if (args[3] == "gccdepfile") { format = cmDepfileFormat::GccDepfile; - } else if (args[3] == "vstlog") { - format = cmDepfileFormat::VsTlog; } else if (args[3] == "makedepfile") { format = cmDepfileFormat::MakeDepfile; } else { diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 700eaf7..39a19cb 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -332,9 +332,10 @@ static bool CheckFileOperations() // While we're at it, check proper TestFileAccess functionality. bool do_write_test = true; -#if defined(__linux__) - // If we are running as root on linux ignore this check, as - // root can always write to files +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ + defined(__NetBSD__) || defined(__DragonFly__) + // If we are running as root on POSIX-ish systems (Linux and the BSDs, + // at least), ignore this check, as root can always write to files. do_write_test = (getuid() != 0); #endif if (do_write_test && diff --git a/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt new file mode 100644 index 0000000..e6f9325 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt @@ -0,0 +1,3 @@ +Cannot find file: [^ +]*/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-build/DartConfiguration.tcl +Binary directory is not set. No coverage checking will be performed.$ diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index afec011..4b654f8 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -360,6 +360,10 @@ run_NoTests() # Check the configuration type variable is passed run_ctest(check-configuration-type) +run_cmake_command(EmptyDirCoverage-ctest + ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage + ) + function(run_MemCheckSan case opts) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build) diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake index 9a38b95..1ce723b 100644 --- a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake +++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake @@ -5,10 +5,6 @@ function(run_transform_depfile name) run_cmake_command(${name}-gcc ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" gccdepfile "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.d ) - set(RunCMake-check-file vstlog.cmake) - run_cmake_command(${name}-tlog - ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" vstlog "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.tlog - ) endfunction() if(WIN32) diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index 9c59b4b..ad6b258 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -43,3 +43,20 @@ if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config") unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) endif() + +function(test_genex name) + run_cmake(${name}) + + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${name}-build") + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) + + if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/wdir/touched") + message(SEND_ERROR "File not created by target-dependent add_custom_command()!") + endif() + + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_BINARY_DIR) +endfunction() + +test_genex(TargetGenexEvent) diff --git a/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake b/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake new file mode 100644 index 0000000..8591b74 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetGenexEvent.cmake @@ -0,0 +1,10 @@ +add_custom_target(target ALL) +set_target_properties(target PROPERTIES COMPILE_DEFINITIONS "touched" COMPILE_OPTIONS "${CMAKE_BINARY_DIR}/wdir") +file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/wdir") + +add_custom_command( + TARGET target + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E touch $<TARGET_PROPERTY:COMPILE_DEFINITIONS> + WORKING_DIRECTORY $<TARGET_PROPERTY:COMPILE_OPTIONS> +) 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/$<TARGET_FILE_NAME:dep1>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep1>" + "${CMAKE_INSTALL_PREFIX}/bin/../bin/$<TARGET_FILE_NAME:dep2>" + "${CMAKE_INSTALL_PREFIX}/bin/../lib/$<TARGET_FILE_NAME:dep2>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep8>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep8>" + POST_EXCLUDE_FILES + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep3>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep5>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep5>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep6>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep6>" + "${CMAKE_INSTALL_PREFIX}/bin/../bin/$<TARGET_FILE_NAME:dep7>" + "${CMAKE_INSTALL_PREFIX}/bin/../lib/$<TARGET_FILE_NAME:dep7>" + POST_EXCLUDE_FILES_STRICT + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep8>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep8>" + "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:dep9>" + "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:dep9>" + ${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/$<TARGET_FILE_NAME:exe>" + ) + ]]) 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]=] |