diff options
author | Brad King <brad.king@kitware.com> | 2022-07-06 13:12:57 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-07-06 13:13:05 (GMT) |
commit | 9b051f557eef1ed99ba264f5528a00818413f34d (patch) | |
tree | 5ea602b4920eaa7048db7b7f3f9905f9fa6240ff | |
parent | 4a8db1783ccc48bfdb9060dfff5775ba42cd94cb (diff) | |
parent | e8792da04b7980c11e0b1b62ea618953876d1f39 (diff) | |
download | CMake-9b051f557eef1ed99ba264f5528a00818413f34d.zip CMake-9b051f557eef1ed99ba264f5528a00818413f34d.tar.gz CMake-9b051f557eef1ed99ba264f5528a00818413f34d.tar.bz2 |
Merge topic 'genex-LINK_LIBRARY-fix-generation' into release-3.24
e8792da04b genex-LINK_LIBRARY: ensure correct generation inside LINK_GROUP genex
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7443
5 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e156e3d..850b7a3 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -549,6 +549,17 @@ bool cmComputeLinkInformation::Compute() if (linkEntry.Kind == cmComputeLinkDepends::LinkEntry::Group) { const auto& groupFeature = this->GetGroupFeature(linkEntry.Feature); if (groupFeature.Supported) { + if (linkEntry.Item.Value == "</LINK_GROUP>" && + currentFeature != nullptr) { + // emit feature suffix, if any + if (!currentFeature->Suffix.empty()) { + this->Items.emplace_back( + BT<std::string>{ currentFeature->Suffix, + this->Items.back().Value.Backtrace }, + ItemIsPath::No); + } + currentFeature = nullptr; + } this->Items.emplace_back( BT<std::string>{ linkEntry.Item.Value == "<LINK_GROUP>" ? groupFeature.Prefix diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake new file mode 100644 index 0000000..b6cabf5 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-check.cmake @@ -0,0 +1,4 @@ + +if (NOT actual_stdout MATCHES "(/|-)-START_GROUP\"? +\"?(/|-)-PREFIX_LIBRARY\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base1${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-LIBFLAG.*${LINK_SHARED_LIBRARY_PREFIX}base2${LINK_SHARED_LIBRARY_SUFFIX}\"? +\"?(/|-)-SUFFIX_LIBRARY\"? +\"?(/|-)-END_GROUP") + set (RunCMake_TEST_FAILED "Not found expected '--START_GROUP --PREFIX_LIBRARY --LIBFLAG<base1> --LIBFLAG<base2> --END_GROUP'.") +endif() diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP-with-LINK_LIBRARY2-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake index 31eb7e2..fea2f91 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/LINK_GROUP.cmake @@ -20,6 +20,9 @@ set(CMAKE_C_LINK_GROUP_USING_feat1_SUPPORTED TRUE) set(CMAKE_C_LINK_LIBRARY_USING_feat1 "--LIBFLAG<LIBRARY>") set(CMAKE_C_LINK_LIBRARY_USING_feat1_SUPPORTED TRUE) +set(CMAKE_C_LINK_LIBRARY_USING_feat2 "--PREFIX_LIBRARY" "--LIBFLAG<LIBRARY>" "--SUFFIX_LIBRARY") +set(CMAKE_C_LINK_LIBRARY_USING_feat2_SUPPORTED TRUE) + set(CMAKE_C_LINK_GROUP_USING_feat2 "--START_GROUP" "--END_GROUP") set(CMAKE_LINK_GROUP_USING_feat2 "--START_GROUP" "--END_GROUP") set(CMAKE_LINK_GROUP_USING_feat2_SUPPORTED TRUE) @@ -53,6 +56,9 @@ target_link_libraries(LinkGroup_group-and-single PRIVATE "$<LINK_GROUP:feat1,bas add_library(LinkGroup_with-LINK_LIBRARY SHARED lib.c) target_link_libraries(LinkGroup_with-LINK_LIBRARY PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat1,base1>,base2>") +add_library(LinkGroup_with-LINK_LIBRARY2 SHARED lib.c) +target_link_libraries(LinkGroup_with-LINK_LIBRARY2 PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat2,base1,base2>>") + add_library(LinkGroup_with-LINK_LIBRARY_OVERRIDE SHARED lib.c) target_link_libraries(LinkGroup_with-LINK_LIBRARY_OVERRIDE PRIVATE "$<LINK_GROUP:feat1,$<LINK_LIBRARY:feat1,base1,base3>,base2>") diff --git a/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake index c1d74d0..3ebe269 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_GROUP/RunCMakeTest.cmake @@ -46,6 +46,7 @@ if ((RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Xcode" run_cmake_target(LINK_GROUP multiple-groups LinkGroup_multiple-groups) run_cmake_target(LINK_GROUP group-and-single LinkGroup_group-and-single) run_cmake_target(LINK_GROUP with-LINK_LIBRARY LinkGroup_with-LINK_LIBRARY) + run_cmake_target(LINK_GROUP with-LINK_LIBRARY2 LinkGroup_with-LINK_LIBRARY2) run_cmake_target(LINK_GROUP with-LINK_LIBRARY_OVERRIDE LinkGroup_with-LINK_LIBRARY_OVERRIDE) run_cmake(imported-target) |