CPack Tests the different ways of packaging components
This commit is contained in:
parent
04d4afbfa8
commit
92ced20fa1
|
@ -563,30 +563,40 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
||||||
|
|
||||||
IF(CTEST_RUN_CPackComponentsForAll)
|
IF(CTEST_RUN_CPackComponentsForAll)
|
||||||
set(CPackComponentsForAll_EXTRA_OPTIONS)
|
set(CPackComponentsForAll_EXTRA_OPTIONS)
|
||||||
|
|
||||||
set(CPackRun_CPackGen "-DCPackGen=ZIP")
|
|
||||||
set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}")
|
set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}")
|
||||||
set(CPackRun_CPackComponentWay "-DCPackComponentWay=default")
|
# set up list of CPack generators
|
||||||
|
list(APPEND GENLST "ZIP")
|
||||||
ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND}
|
# set up list of component packaging ways
|
||||||
|
list(APPEND CWAYLST "default")
|
||||||
|
list(APPEND CWAYLST "OnePackPerGroup")
|
||||||
|
list(APPEND CWAYLST "IgnoreGroup")
|
||||||
|
list(APPEND CWAYLST "AllInOne")
|
||||||
|
list(APPEND CWAYLST "AllGroupsInOne")
|
||||||
|
foreach(CPackGen IN LISTS GENLST)
|
||||||
|
set(CPackRun_CPackGen "-DCPackGen=${CPackGen}")
|
||||||
|
foreach(CPackComponentWay IN LISTS CWAYLST)
|
||||||
|
set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}")
|
||||||
|
ADD_TEST(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
|
"${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll"
|
||||||
"${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
|
"${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
|
||||||
--build-generator ${CMAKE_TEST_GENERATOR}
|
--build-generator ${CMAKE_TEST_GENERATOR}
|
||||||
--build-project CPackComponentsForAll
|
--build-project CPackComponentsForAll
|
||||||
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
||||||
--build-options
|
--build-options
|
||||||
-DCPACK_BINARY_ZIP:BOOL=ON
|
-DCPACK_BINARY_${CPackGen}:BOOL=ON
|
||||||
|
${CPackRun_CPackComponentWay}
|
||||||
${CPackComponentsForAll_EXTRA_OPTIONS}
|
${CPackComponentsForAll_EXTRA_OPTIONS}
|
||||||
--graphviz=CPackComponentsForAll.dot
|
--graphviz=CPackComponentsForAll.dot
|
||||||
--test-command ${CMAKE_CMAKE_COMMAND}
|
--test-command ${CMAKE_CMAKE_COMMAND}
|
||||||
"-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent"
|
"-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}"
|
||||||
"${CPackRun_CPackCommand}"
|
"${CPackRun_CPackCommand}"
|
||||||
"${CPackRun_CPackGen}"
|
"${CPackRun_CPackGen}"
|
||||||
"${CPackRun_CPackComponentWay}"
|
"${CPackRun_CPackComponentWay}"
|
||||||
-P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake")
|
-P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake")
|
||||||
|
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/build${CPackGen}-${CPackComponentWay}")
|
||||||
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll")
|
endforeach(CPackComponentWay)
|
||||||
|
endforeach(CPackGen)
|
||||||
ENDIF(CTEST_RUN_CPackComponentsForAll)
|
ENDIF(CTEST_RUN_CPackComponentsForAll)
|
||||||
|
|
||||||
# By default, turn this test off (because it takes a long time...)
|
# By default, turn this test off (because it takes a long time...)
|
||||||
|
|
|
@ -107,14 +107,14 @@ set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
|
||||||
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
|
set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
|
||||||
|
|
||||||
# We may use the CPack specific config file in order
|
# We may use the CPack specific config file in order
|
||||||
# to tailor CPack behavio on a CPack generator specific way
|
# to tailor CPack behavior on a CPack generator specific way
|
||||||
# (Behavior would be different for RPM or TGZ or DEB ...)
|
# (Behavior would be different for RPM or TGZ or DEB ...)
|
||||||
if (USE_CPACK_PROJECT_CONFIG)
|
if (NOT ("${CPackComponentWay}" STREQUAL "default"))
|
||||||
# Setup project specific CPack-time CPack Config file.
|
# Setup project specific CPack-time CPack Config file.
|
||||||
configure_file(${MyLib_SOURCE_DIR}/MyLibCPackConfig.cmake.in
|
configure_file(${CPackComponentsForAll_SOURCE_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake.in
|
||||||
${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake
|
${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake
|
||||||
@ONLY)
|
@ONLY)
|
||||||
set(CPACK_PROJECT_CONFIG_FILE ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake)
|
set(CPACK_PROJECT_CONFIG_FILE ${CPackComponentsForAll_BINARY_DIR}/MyLibCPackConfig-${CPackComponentWay}.cmake)
|
||||||
endif (USE_CPACK_PROJECT_CONFIG)
|
endif (NOT ("${CPackComponentWay}" STREQUAL "default"))
|
||||||
# Include CPack to introduce the appropriate targets
|
# Include CPack to introduce the appropriate targets
|
||||||
include(CPack)
|
include(CPack)
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# Activate component packaging
|
||||||
|
#
|
||||||
|
if(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
|
||||||
|
if(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
set(CPACK_RPM_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Choose grouping way
|
||||||
|
#
|
||||||
|
set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
|
||||||
|
#set(CPACK_COMPONENTS_GROUPING)
|
||||||
|
#set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
|
||||||
|
#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# Activate component packaging
|
||||||
|
#
|
||||||
|
if(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
|
||||||
|
if(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
set(CPACK_RPM_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Choose grouping way
|
||||||
|
#
|
||||||
|
#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE 1)
|
||||||
|
#set(CPACK_COMPONENTS_GROUPING)
|
||||||
|
#set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
|
||||||
|
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# Activate component packaging
|
||||||
|
#
|
||||||
|
if(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
|
||||||
|
if(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
set(CPACK_RPM_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Choose grouping way
|
||||||
|
#
|
||||||
|
#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
|
||||||
|
#set(CPACK_COMPONENTS_GROUPING)
|
||||||
|
set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
|
||||||
|
#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# Activate component packaging
|
||||||
|
#
|
||||||
|
if(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "ZIP")
|
||||||
|
|
||||||
|
if(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
set(CPACK_RPM_COMPONENT_INSTALL "ON")
|
||||||
|
endif(CPACK_GENERATOR MATCHES "RPM")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Choose grouping way
|
||||||
|
#
|
||||||
|
#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
|
||||||
|
#set(CPACK_COMPONENTS_GROUPING)
|
||||||
|
#set(CPACK_COMPONENTS_IGNORE_GROUPS)
|
||||||
|
#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE)
|
|
@ -1,7 +0,0 @@
|
||||||
if(CPACK_GENERATOR MATCHES "ZIP")
|
|
||||||
# set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
|
|
||||||
endif(CPACK_GENERATOR MATCHES "ZIP")
|
|
||||||
|
|
||||||
if(CPACK_GENERATOR MATCHES "TGZ")
|
|
||||||
set(CPACK_MONOLITHIC_INSTALL 1)
|
|
||||||
endif(CPACK_GENERATOR MATCHES "TGZ")
|
|
|
@ -49,6 +49,18 @@ if(CPackGen MATCHES "ZIP")
|
||||||
if (${CPackComponentWay} STREQUAL "default")
|
if (${CPackComponentWay} STREQUAL "default")
|
||||||
set(expected_count 1)
|
set(expected_count 1)
|
||||||
endif(${CPackComponentWay} STREQUAL "default")
|
endif(${CPackComponentWay} STREQUAL "default")
|
||||||
|
if (${CPackComponentWay} STREQUAL "OnePackPerGroup")
|
||||||
|
set(expected_count 2)
|
||||||
|
endif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
|
||||||
|
if (${CPackComponentWay} STREQUAL "IgnoreGroup")
|
||||||
|
set(expected_count 4)
|
||||||
|
endif (${CPackComponentWay} STREQUAL "IgnoreGroup")
|
||||||
|
if (${CPackComponentWay} STREQUAL "AllInOne")
|
||||||
|
set(expected_count 1)
|
||||||
|
endif (${CPackComponentWay} STREQUAL "AllInOne")
|
||||||
|
if (${CPackComponentWay} STREQUAL "AllGroupsInOne")
|
||||||
|
set(expected_count 1)
|
||||||
|
endif (${CPackComponentWay} STREQUAL "AllGroupsInOne")
|
||||||
endif(CPackGen MATCHES "ZIP")
|
endif(CPackGen MATCHES "ZIP")
|
||||||
|
|
||||||
# Now verify if the number of expected file is OK
|
# Now verify if the number of expected file is OK
|
||||||
|
|
Loading…
Reference in New Issue