From b0536e29eaf2edbf798cd98884eb3a31ebf4f781 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 29 Oct 2008 12:27:19 -0400 Subject: [PATCH] ENH: Use settings for CPackComponents test to make it fail if the recent fix of cmCPackGenerator.cxx revision 1.16 ever encounters another regression. --- Tests/CMakeLists.txt | 3 +++ Tests/CPackComponents/CMakeLists.txt | 29 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 74a59a2a6..b0310ed31 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -391,6 +391,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-target package + --build-options + -DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB} + -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents" -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake") diff --git a/Tests/CPackComponents/CMakeLists.txt b/Tests/CPackComponents/CMakeLists.txt index d34490af2..d41faa09a 100644 --- a/Tests/CPackComponents/CMakeLists.txt +++ b/Tests/CPackComponents/CMakeLists.txt @@ -14,8 +14,19 @@ add_library(mylib mylib.cpp) add_executable(mylibapp mylibapp.cpp) target_link_libraries(mylibapp mylib) +# On Linux, enable using an absolute install path to verify that +# CMAKE_INSTALL_PREFIX and CPACK_SET_DESTDIR interact properly. +if(UNIX AND NOT APPLE) + set(mylib_install_to_absolute_path ON) +endif() + +if(mylib_install_to_absolute_path) + set(CMAKE_INSTALL_PREFIX "/opt/mylib") + set(CPACK_SET_DESTDIR ON) +endif() + # Create installation targets. Note that we put each kind of file -# into a different component via COMPONENT. These components will +# into a different component via COMPONENT. These components will # be used to create the installation components. install(TARGETS mylib ARCHIVE @@ -29,9 +40,16 @@ install(FILES mylib.h DESTINATION include COMPONENT headers) +if(mylib_install_to_absolute_path) + install(FILES mylib.cpp + DESTINATION /opt/mylib-source + COMPONENT source) +endif() + # CPack boilerplate for this project set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_VENDOR "CMake.org") +set(CPACK_PACKAGE_CONTACT "somebody@cmake.org") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example") set(CPACK_PACKAGE_VERSION "1.0.0") set(CPACK_PACKAGE_VERSION_MAJOR "1") @@ -70,3 +88,12 @@ cpack_add_component(headers GROUP Development DEPENDS libraries INSTALL_TYPES Developer Full) + +if(mylib_install_to_absolute_path) + cpack_add_component(source + DISPLAY_NAME "C++ Source Files" + DESCRIPTION "C/C++ source files to build MyLib" + GROUP Development + DEPENDS libraries + INSTALL_TYPES Developer Full) +endif()