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
+28 -1
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()