ENH: Use settings for CPackComponents test to make it fail if the recent fix of cmCPackGenerator.cxx revision 1.16 ever encounters another regression.

This commit is contained in:
David Cole 2008-10-29 12:27:19 -04:00
parent 351ef7c187
commit b0536e29ea
2 changed files with 31 additions and 1 deletions

View File

@ -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")

View File

@ -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()