diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-11-08 13:31:25 +0100 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-11-08 13:54:49 +0100 |
commit | 4ce9742ae33678d8fce189d172c2fffb1a43061c (patch) | |
tree | c6c5430ad37f438cb0225d620b8f63e4adcd15e5 /Tests/AliasTarget | |
parent | 39e830a98e81929ce95694f2f81d92ffd3f14d5b (diff) | |
download | cmake-4ce9742ae33678d8fce189d172c2fffb1a43061c.tar.gz |
Alias: Fix access at generate-time (#15832)
Commit c389f8bb (cmLocalGenerator: Port Find method away from
GetGeneratorTarget, 2015-10-25) ported the implementation of
FindGeneratorTargetToUse away from the FindTargetToUse method,
but neglected to handle alias targets.
The latter method has a parameter to determine whether to
include alias targets in the search, but as that is only
needed at configure time, this generate-time equivalent does
not need the condition.
Diffstat (limited to 'Tests/AliasTarget')
-rw-r--r-- | Tests/AliasTarget/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/AliasTarget/subdir/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/AliasTarget/subdir/empty.cpp | 7 |
3 files changed, 13 insertions, 1 deletions
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index c50b4e6a84..e1d89666ee 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -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) diff --git a/Tests/AliasTarget/subdir/CMakeLists.txt b/Tests/AliasTarget/subdir/CMakeLists.txt new file mode 100644 index 0000000000..8c84aea3c2 --- /dev/null +++ b/Tests/AliasTarget/subdir/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_library(tgt STATIC empty.cpp) +add_library(Sub::tgt ALIAS tgt) diff --git a/Tests/AliasTarget/subdir/empty.cpp b/Tests/AliasTarget/subdir/empty.cpp new file mode 100644 index 0000000000..b19427ad08 --- /dev/null +++ b/Tests/AliasTarget/subdir/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int main(void) +{ + return 0; +} |