Merge topic 'fix-alias-target-access'

4ce9742a Alias: Fix access at generate-time (#15832)
This commit is contained in:
Brad King 2015-11-09 10:06:33 -05:00 committed by CMake Topic Stage
commit ed484544cb
4 changed files with 19 additions and 1 deletions

View File

@ -2274,6 +2274,12 @@ cmGlobalGenerator::FindTarget(const std::string& name,
cmGeneratorTarget*
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))
{
return tgt;

View File

@ -37,7 +37,9 @@ target_include_directories(bat PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(targetgenerator targetgenerator.cpp)
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)
if (NOT TARGET Another::Alias)

View File

@ -0,0 +1,3 @@
add_library(tgt STATIC empty.cpp)
add_library(Sub::tgt ALIAS tgt)

View File

@ -0,0 +1,7 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
int main(void)
{
return 0;
}