diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-08-27 19:15:26 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-08-27 19:15:26 (GMT) |
commit | 556b1257ac5e961a5fbc652f51acf157f157bed8 (patch) | |
tree | 2ec3d4b788ba235bd5f56b09be57e58854a9cc76 /Tests | |
parent | cfd9fdf5de3eaa40f2596d28d2c46cc82fe9d9c4 (diff) | |
download | CMake-556b1257ac5e961a5fbc652f51acf157f157bed8.zip CMake-556b1257ac5e961a5fbc652f51acf157f157bed8.tar.gz CMake-556b1257ac5e961a5fbc652f51acf157f157bed8.tar.bz2 |
COMP: add a test for exporting and importing targets
Alex
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/SimpleInstall/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Tests/SimpleInstallS2/CMakeLists.txt | 18 |
2 files changed, 34 insertions, 2 deletions
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index bb1634f..2dc1412 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. diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index bb1634f..2dc1412 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/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. |