summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-10 13:12:32 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-03-10 13:12:32 (GMT)
commitcce9671b4fea099c5109569108bca2dafe92a97e (patch)
tree23ba104b142dcdb9e42cfc8988deeec8cbd5d242 /Tests
parent976c3ccc6aa62d58a613fe3106c73fce134123e2 (diff)
parent86032ae0ebb7e86f3ff5617e080dd827dbbe98b0 (diff)
downloadCMake-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.txt21
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