Merge topic 'collect-genex-fix'

6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11322
This commit is contained in:
Brad King 2025-10-20 17:42:12 +00:00 committed by Kitware Robot
commit 1538875ba3
3 changed files with 12 additions and 7 deletions

View File

@ -191,16 +191,17 @@ static std::string extractAllGeneratorExpressions(
colons.push(c);
}
} else if (c[0] == '>') {
if (collected && !starts.empty() && !colons.empty()) {
(*collected)[std::string(starts.top() + 2, colons.top())].push_back(
std::string(colons.top() + 1, c));
if (!colons.empty() && !starts.empty() &&
starts.top() < colons.top()) {
if (collected) {
(*collected)[std::string(starts.top() + 2, colons.top())]
.push_back(std::string(colons.top() + 1, c));
}
colons.pop();
}
if (!starts.empty()) {
starts.pop();
}
if (!colons.empty()) {
colons.pop();
}
if (starts.empty()) {
break;
}

View File

@ -2,7 +2,7 @@ project(LinkInterfaceGeneratorExpression CXX)
add_library(foo foo.cxx)
add_library(bar foo.cxx)
target_link_libraries(bar $<1:foo>)
target_link_libraries(bar $<1:foo> $<1:$<CONFIG>>)
install(TARGETS foo EXPORT foo)
export(EXPORT foo PACKAGE_INFO foo)

View File

@ -35,3 +35,7 @@ test_strip( # Multiple case
"1$<AND:1,0>2$<IF:$<$<BOOL:1>:$<CONFIG:RELEASE>>,TRUE,FALSE>3"
"123"
)
test_strip( # No : inside of :
"$<1:$<SEMICOLON>>1"
"1"
)