Merge topic 'fix-alias-target-access'
4ce9742a
Alias: Fix access at generate-time (#15832)
This commit is contained in:
commit
ed484544cb
|
@ -2274,6 +2274,12 @@ cmGlobalGenerator::FindTarget(const std::string& name,
|
||||||
cmGeneratorTarget*
|
cmGeneratorTarget*
|
||||||
cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const
|
cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const
|
||||||
{
|
{
|
||||||
|
std::map<std::string, std::string>::const_iterator ai =
|
||||||
|
this->AliasTargets.find(name);
|
||||||
|
if (ai != this->AliasTargets.end())
|
||||||
|
{
|
||||||
|
return this->FindGeneratorTargetImpl(ai->second);
|
||||||
|
}
|
||||||
if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name))
|
if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name))
|
||||||
{
|
{
|
||||||
return tgt;
|
return tgt;
|
||||||
|
|
|
@ -37,7 +37,9 @@ target_include_directories(bat PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
add_executable(targetgenerator targetgenerator.cpp)
|
add_executable(targetgenerator targetgenerator.cpp)
|
||||||
add_executable(Generator::Target ALIAS targetgenerator)
|
add_executable(Generator::Target ALIAS targetgenerator)
|
||||||
|
|
||||||
add_custom_target(usealias Generator::Target)
|
add_subdirectory(subdir)
|
||||||
|
|
||||||
|
add_custom_target(usealias Generator::Target $<TARGET_FILE:Sub::tgt>)
|
||||||
add_dependencies(bat usealias)
|
add_dependencies(bat usealias)
|
||||||
|
|
||||||
if (NOT TARGET Another::Alias)
|
if (NOT TARGET Another::Alias)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
add_library(tgt STATIC empty.cpp)
|
||||||
|
add_library(Sub::tgt ALIAS tgt)
|
|
@ -0,0 +1,7 @@
|
||||||
|
#ifdef _WIN32
|
||||||
|
__declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue