summaryrefslogtreecommitdiff
path: root/Tests/SimpleInstall
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-27 15:15:26 -0400
committerAlexander Neundorf <neundorf@kde.org>2007-08-27 15:15:26 -0400
commit556b1257ac5e961a5fbc652f51acf157f157bed8 (patch)
tree2ec3d4b788ba235bd5f56b09be57e58854a9cc76 /Tests/SimpleInstall
parentcfd9fdf5de3eaa40f2596d28d2c46cc82fe9d9c4 (diff)
downloadcmake-556b1257ac5e961a5fbc652f51acf157f157bed8.tar.gz
COMP: add a test for exporting and importing targets
Alex
Diffstat (limited to 'Tests/SimpleInstall')
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index bb1634f6e3..2dc1412997 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -134,6 +134,15 @@ IF(STAGE2)
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
INSTALL_TARGETS(/MyTest/bin SimpleInstallS2)
+
+# try to import the exported targets again
+ SET(SimpleInstallS1_DIR ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
+ FIND_PACKAGE(SimpleInstallS1 REQUIRED)
+ GET_TARGET_PROPERTY(simpleInstallLocation S1_SimpleInstall LOCATION)
+ IF(NOT simpleInstallLocation)
+ MESSAGE(FATAL_ERROR "Target S1_SimpleInstall could not be imported, location: ${simpleInstallLocation}")
+ ENDIF(NOT simpleInstallLocation)
+
ELSE(STAGE2)
# Wipe out the install directory to do a fresh test.
FILE(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/MyTest)
@@ -164,11 +173,12 @@ ELSE(STAGE2)
ADD_DEPENDENCIES(test2 test3)
ADD_DEPENDENCIES(test4 test2)
- INSTALL(TARGETS SimpleInstall test1 test2 test3
+ INSTALL(TARGETS SimpleInstall test1 test2 test3 EXPORT SimpleInstallS1
RUNTIME DESTINATION MyTest/bin COMPONENT Runtime # .exe, .dll
LIBRARY DESTINATION MyTest/lib COMPONENT Runtime # .so, mod.dll
ARCHIVE DESTINATION MyTest/lib/static COMPONENT Development # .a, .lib
)
+
INSTALL(TARGETS test4 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
RUNTIME DESTINATION MyTest/bin
LIBRARY DESTINATION MyTest/lib
@@ -191,6 +201,12 @@ ELSE(STAGE2)
scripts/sample_script scripts/sample_script.bat)
INSTALL_PROGRAMS(/MyTest/share/old2
scripts/sample_script scripts/sample_script.bat)
+
+# "export" the targets collected in "SimpleInstallS1"
+ INSTALL(EXPORT SimpleInstallS1 FILENAME SimpleInstallS1Config.cmake
+ DESTINATION MyTest/lib
+ PREFIX S1_ )
+
ADD_SUBDIRECTORY(scripts)
# Test optional installation.