diff options
author | Brad King <brad.king@kitware.com> | 2015-03-10 13:12:32 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-03-10 13:12:32 (GMT) |
commit | cce9671b4fea099c5109569108bca2dafe92a97e (patch) | |
tree | 23ba104b142dcdb9e42cfc8988deeec8cbd5d242 /Tests | |
parent | 976c3ccc6aa62d58a613fe3106c73fce134123e2 (diff) | |
parent | 86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 (diff) | |
download | CMake-cce9671b4fea099c5109569108bca2dafe92a97e.zip CMake-cce9671b4fea099c5109569108bca2dafe92a97e.tar.gz CMake-cce9671b4fea099c5109569108bca2dafe92a97e.tar.bz2 |
Merge topic 'ExternalProject-byproducts-tokens'
86032ae0 ExternalProject: Replace placeholder tokens in BYPRODUCTS
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CustomCommandByproducts/CMakeLists.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/CustomCommandByproducts/CMakeLists.txt b/Tests/CustomCommandByproducts/CMakeLists.txt index 884f8c2..3289e8f 100644 --- a/Tests/CustomCommandByproducts/CMakeLists.txt +++ b/Tests/CustomCommandByproducts/CMakeLists.txt @@ -102,6 +102,27 @@ add_library(ExternalLibrary STATIC IMPORTED) set_property(TARGET ExternalLibrary PROPERTY IMPORTED_LOCATION ${ExternalLibrary_LIBRARY}) add_dependencies(ExternalLibrary ExternalTarget) +# Generate the library file of an imported target as a byproduct +# of an external project. The byproduct uses <BINARY_DIR> that is substituted +# by the real binary path +if(CMAKE_CONFIGURATION_TYPES) + set(cfg /${CMAKE_CFG_INTDIR}) +else() + set(cfg) +endif() +include(ExternalProject) +ExternalProject_Add(ExtTargetSubst + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + DOWNLOAD_COMMAND "" + INSTALL_COMMAND "" + BUILD_BYPRODUCTS "<BINARY_DIR>${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) +ExternalProject_Get_Property(ExtTargetSubst binary_dir) +add_library(ExternalLibraryWithSubstitution STATIC IMPORTED) +set_property(TARGET ExternalLibraryWithSubstitution PROPERTY IMPORTED_LOCATION + ${binary_dir}${cfg}/${CMAKE_STATIC_LIBRARY_PREFIX}ExternalLibrary${CMAKE_STATIC_LIBRARY_SUFFIX}) +add_dependencies(ExternalLibraryWithSubstitution ExtTargetSubst) + # Add an executable consuming all the byproducts. add_executable(CustomCommandByproducts CustomCommandByproducts.c |