mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-08 06:40:48 -06:00
Merge topic 'fix-cps-relative-name-mangling'
9081e73104 CPS: Fix mangling of relative requirement names
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10729
This commit is contained in:
@@ -212,7 +212,7 @@ std::string NormalizeTargetName(std::string const& name,
|
||||
std::string const& context)
|
||||
{
|
||||
if (cmHasLiteralPrefix(name, ":")) {
|
||||
return cmStrCat(context, name);
|
||||
return cmStrCat(context, ':', name);
|
||||
}
|
||||
|
||||
std::string::size_type const n = name.find_first_of(':');
|
||||
|
||||
@@ -175,6 +175,14 @@ else()
|
||||
target_link_libraries(defs-test defs::defs)
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# Test importing and mangling of requirements (i.e. link libraries).
|
||||
|
||||
find_package(RequiresTest CONFIG REQUIRED)
|
||||
|
||||
add_library(requires-test STATIC requires-test.cxx)
|
||||
target_link_libraries(requires-test RequiresTest::Indirect)
|
||||
|
||||
###############################################################################
|
||||
# Test importing of (language-specific) include paths.
|
||||
|
||||
|
||||
19
Tests/FindPackageCpsTest/cps/RequiresTest.cps
Normal file
19
Tests/FindPackageCpsTest/cps/RequiresTest.cps
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"cps_version": "0.13",
|
||||
"name": "RequiresTest",
|
||||
"cps_path": "@prefix@/cps",
|
||||
"components": {
|
||||
"Indirect": {
|
||||
"type": "interface",
|
||||
"requires": [ ":Direct" ]
|
||||
},
|
||||
"Direct": {
|
||||
"type": "interface",
|
||||
"definitions": {
|
||||
"*": {
|
||||
"ANSWER": 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Tests/FindPackageCpsTest/requires-test.cxx
Normal file
7
Tests/FindPackageCpsTest/requires-test.cxx
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef ANSWER
|
||||
# error ANSWER is not defined
|
||||
#else
|
||||
# if ANSWER != 42
|
||||
# error ANSWER has the wrong value
|
||||
# endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user