This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 5f6fe805da87fc1d3b4b66d0e9917643b626dd15 (commit) via 87f44b7525ebc9761b32b98f0c9e1276431e6ec1 (commit) from ba189140f63bfd9166356ff608f1c281b9c0a394 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f6fe805da87fc1d3b4b66d0e9917643b626dd15 commit 5f6fe805da87fc1d3b4b66d0e9917643b626dd15 Merge: ba18914 87f44b7 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Feb 17 14:11:35 2016 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Wed Feb 17 14:11:35 2016 -0500 Merge topic 'fix-static-private-non-target-depends' into next 87f44b75 Fix export of STATIC library PRIVATE non-target dependencies https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87f44b7525ebc9761b32b98f0c9e1276431e6ec1 commit 87f44b7525ebc9761b32b98f0c9e1276431e6ec1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Wed Feb 17 13:34:15 2016 -0500 Commit: Brad King <brad.k...@kitware.com> CommitDate: Wed Feb 17 14:01:11 2016 -0500 Fix export of STATIC library PRIVATE non-target dependencies In commit v3.5.0-rc1~43^2 (Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW, 2016-01-15) we taught target_link_libraries to generate `$<LINK_ONLY:$<TARGET_NAME:dep>>` in INTERFACE_LINK_LIBRARIES instead of `$<LINK_ONLY:dep>` so that `dep` can be recognized as a target name and updated during export. However, this approach does not work when `dep` is just a plain library name and not a target because `$<TARGET_NAME:...>` requires the name of a reachable target. Since we do not know during target_link_libraries whether the name will correspond to a reachable target or not, we cannot inject the `$<TARGET_NAME:...>` expression. Revert this change and solve the original problem instead by teaching the export logic to recognize and update target names directly in `$<LINK_ONLY:...>` expressions. Reported-by: Ben Boeckel <ben.boec...@kitware.com> diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index e8a2e6a..c005995 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -772,6 +772,27 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression( lastPos = endPos; } + pos = 0; + lastPos = pos; + while (errorString.empty() && + (pos = input.find("$<LINK_ONLY:", lastPos)) != input.npos) + { + std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1; + std::string::size_type endPos = input.find(">", nameStartPos); + if (endPos == input.npos) + { + errorString = "$<LINK_ONLY:...> expression incomplete"; + break; + } + std::string libName = input.substr(nameStartPos, endPos - nameStartPos); + if (cmGeneratorExpression::IsValidTargetName(libName) && + this->AddTargetNamespace(libName, target, missingTargets)) + { + input.replace(nameStartPos, endPos - nameStartPos, libName); + } + lastPos = nameStartPos + libName.size() + 1; + } + this->ReplaceInstallPrefix(input); if (!errorString.empty()) diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 5f3246a..435346a 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -432,11 +432,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { std::string configLib = this->Target ->GetDebugGeneratorExpressions(lib, llt); - if (cmGeneratorExpression::IsValidTargetName(configLib)) - { - configLib = "$<LINK_ONLY:$<TARGET_NAME:" + configLib + ">>"; - } - else if (cmGeneratorExpression::Find(configLib) != std::string::npos) + if (cmGeneratorExpression::IsValidTargetName(lib) + || cmGeneratorExpression::Find(lib) != std::string::npos) { configLib = "$<LINK_ONLY:" + configLib + ">"; } diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 8307607..1466fbf 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -8,3 +8,5 @@ run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) run_cmake(SubDirTarget) run_cmake(SharedDepNotTarget) +run_cmake(StaticPrivateDepNotExported) +run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt new file mode 100644 index 0000000..6bb44ab --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt @@ -0,0 +1 @@ +CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in the export set. diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake new file mode 100644 index 0000000..9b97918 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0022 NEW) +enable_language(C) +add_library(foo STATIC empty.c) +add_library(not_exported STATIC empty.c) +target_link_libraries(foo PRIVATE not_exported) +install(TARGETS foo EXPORT Exp DESTINATION lib) +install(EXPORT Exp DESTINATION lib/cmake/Exp) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake new file mode 100644 index 0000000..7122ae9 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0022 NEW) +enable_language(C) +add_library(foo STATIC empty.c) +target_link_libraries(foo PRIVATE not_a_target) +install(TARGETS foo EXPORT Exp DESTINATION lib) +install(EXPORT Exp DESTINATION lib/cmake/Exp) ----------------------------------------------------------------------- Summary of changes: Source/cmExportFileGenerator.cxx | 21 ++++++++++++++++++++ Source/cmTargetLinkLibrariesCommand.cxx | 7 ++----- .../target_link_libraries/RunCMakeTest.cmake | 2 ++ .../StaticPrivateDepNotExported-result.txt} | 0 .../StaticPrivateDepNotExported-stderr.txt | 1 + .../StaticPrivateDepNotExported.cmake | 7 +++++++ .../StaticPrivateDepNotTarget.cmake | 6 ++++++ 7 files changed, 39 insertions(+), 5 deletions(-) copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => target_link_libraries/StaticPrivateDepNotExported-result.txt} (100%) create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits