From 53a69c7dd47f693efec85e031b89251dd7bdef2f Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Sat, 26 Nov 2016 18:57:46 +0100 Subject: Tests: CPack move tests to separate dir For greater transparency tests are moved to a subfolder with each test having its own dir. --- Tests/RunCMake/CPack/CMakeLists.txt | 2 +- Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake | 3 -- Tests/RunCMake/CPack/CUSTOM_NAMES.cmake | 5 -- Tests/RunCMake/CPack/DEBUGINFO.cmake | 32 ------------- Tests/RunCMake/CPack/DEB_EXTRA.cmake | 38 --------------- Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake | 16 ------- .../CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake | 17 ------- Tests/RunCMake/CPack/DEPENDENCIES.cmake | 18 -------- Tests/RunCMake/CPack/EMPTY_DIR.cmake | 2 - Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake | 24 ---------- Tests/RunCMake/CPack/LONG_FILENAMES.cmake | 8 ---- Tests/RunCMake/CPack/MAIN_COMPONENT.cmake | 12 ----- Tests/RunCMake/CPack/MINIMAL.cmake | 1 - Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake | 3 -- .../CPack/PARTIALLY_RELOCATABLE_WARNING.cmake | 6 --- Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake | 3 -- Tests/RunCMake/CPack/RPM_DIST.cmake | 3 -- Tests/RunCMake/CPack/RPM_SUGGESTS.cmake | 3 -- Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake | 54 ---------------------- Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake | 7 --- .../CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake | 3 ++ Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake | 5 ++ Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake | 32 +++++++++++++ Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake | 38 +++++++++++++++ .../CPack/tests/DEB_GENERATE_SHLIBS/test.cmake | 16 +++++++ .../tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake | 17 +++++++ Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake | 18 ++++++++ Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake | 2 + .../CPack/tests/INSTALL_SCRIPTS/test.cmake | 24 ++++++++++ .../RunCMake/CPack/tests/LONG_FILENAMES/test.cmake | 8 ++++ .../RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake | 12 +++++ Tests/RunCMake/CPack/tests/MINIMAL/test.cmake | 1 + .../CPack/tests/PACKAGE_CHECKSUM/test.cmake | 3 ++ .../tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake | 6 +++ .../CPack/tests/PER_COMPONENT_FIELDS/test.cmake | 3 ++ Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake | 3 ++ Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake | 3 ++ .../CPack/tests/SINGLE_DEBUGINFO/test.cmake | 54 ++++++++++++++++++++++ .../RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake | 7 +++ 39 files changed, 256 insertions(+), 256 deletions(-) delete mode 100644 Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake delete mode 100644 Tests/RunCMake/CPack/CUSTOM_NAMES.cmake delete mode 100644 Tests/RunCMake/CPack/DEBUGINFO.cmake delete mode 100644 Tests/RunCMake/CPack/DEB_EXTRA.cmake delete mode 100644 Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake delete mode 100644 Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake delete mode 100644 Tests/RunCMake/CPack/DEPENDENCIES.cmake delete mode 100644 Tests/RunCMake/CPack/EMPTY_DIR.cmake delete mode 100644 Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake delete mode 100644 Tests/RunCMake/CPack/LONG_FILENAMES.cmake delete mode 100644 Tests/RunCMake/CPack/MAIN_COMPONENT.cmake delete mode 100644 Tests/RunCMake/CPack/MINIMAL.cmake delete mode 100644 Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake delete mode 100644 Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake delete mode 100644 Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake delete mode 100644 Tests/RunCMake/CPack/RPM_DIST.cmake delete mode 100644 Tests/RunCMake/CPack/RPM_SUGGESTS.cmake delete mode 100644 Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake delete mode 100644 Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake create mode 100644 Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/MINIMAL/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake create mode 100644 Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake diff --git a/Tests/RunCMake/CPack/CMakeLists.txt b/Tests/RunCMake/CPack/CMakeLists.txt index 409245e..c4d9d5d 100644 --- a/Tests/RunCMake/CPack/CMakeLists.txt +++ b/Tests/RunCMake/CPack/CMakeLists.txt @@ -5,7 +5,7 @@ project(${RunCMake_TEST} CXX) # set default test name (can be overwritten in test.cmake or specifics.cmake) string(TOLOWER "${RunCMake_TEST_FILE_PREFIX}" CPACK_PACKAGE_NAME) -include(${RunCMake_TEST_FILE_PREFIX}.cmake) +include(tests/${RunCMake_TEST_FILE_PREFIX}/test.cmake) # include test generator specifics if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${GENERATOR_TYPE}/${RunCMake_TEST_FILE_PREFIX}-specifics.cmake") diff --git a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake b/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake deleted file mode 100644 index 9cd91af..0000000 --- a/Tests/RunCMake/CPack/COMPONENTS_EMPTY_DIR.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(CPACK_COMPONENTS_ALL test) -install(DIRECTORY DESTINATION empty - COMPONENT test) diff --git a/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake b/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake deleted file mode 100644 index 115864f..0000000 --- a/Tests/RunCMake/CPack/CUSTOM_NAMES.cmake +++ /dev/null @@ -1,5 +0,0 @@ -set(CPACK_RPM_COMPONENT_INSTALL "ON") - -install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) -install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) -install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) diff --git a/Tests/RunCMake/CPack/DEBUGINFO.cmake b/Tests/RunCMake/CPack/DEBUGINFO.cmake deleted file mode 100644 index 70b3cb3..0000000 --- a/Tests/RunCMake/CPack/DEBUGINFO.cmake +++ /dev/null @@ -1,32 +0,0 @@ -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - -# PGI compiler doesn't add build id to binaries by default -if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") - string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") - string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") -endif() - -set(CPACK_RPM_COMPONENT_INSTALL "ON") - -set(CMAKE_BUILD_TYPE Debug) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") -add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") -add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -target_link_libraries(test_prog test_lib) - -install(TARGETS test_prog DESTINATION foo COMPONENT applications) -install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) -install(TARGETS test_lib DESTINATION bas COMPONENT libs) - -set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") -set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) -set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) - -set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") diff --git a/Tests/RunCMake/CPack/DEB_EXTRA.cmake b/Tests/RunCMake/CPack/DEB_EXTRA.cmake deleted file mode 100644 index 754561d..0000000 --- a/Tests/RunCMake/CPack/DEB_EXTRA.cmake +++ /dev/null @@ -1,38 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) -install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) -install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/preinst "echo default_preinst") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/prerm "echo default_prerm") - -foreach(file_ preinst prerm) - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/${file_} - DESTINATION ${CMAKE_CURRENT_BINARY_DIR} - FILE_PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE) -endforeach() - -set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/conffiles") - -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/preinst "echo bar_preinst") -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/prerm "echo bar_prerm") - -foreach(file_ preinst prerm) - # not acceptable permissions for lintian but we need to check that - # permissions are preserved - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/${file_} - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bar - FILE_PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE) -endforeach() - -set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA - "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") - -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake deleted file mode 100644 index fa0bc35..0000000 --- a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS.cmake +++ /dev/null @@ -1,16 +0,0 @@ -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEB_COMPONENT_INSTALL "ON") -set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") - -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") -add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") -set_target_properties(test_lib PROPERTIES SOVERSION "0.8") - -install(TARGETS test_lib DESTINATION foo COMPONENT libs) diff --git a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake b/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake deleted file mode 100644 index 2fc9e23..0000000 --- a/Tests/RunCMake/CPack/DEB_GENERATE_SHLIBS_LDCONFIG.cmake +++ /dev/null @@ -1,17 +0,0 @@ -set(CPACK_PACKAGE_CONTACT "someone") -set(CPACK_DEB_COMPONENT_INSTALL "ON") -set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") - -set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") -set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=") - -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") -add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") -set_target_properties(test_lib PROPERTIES SOVERSION "0.8") - -install(TARGETS test_lib LIBRARY DESTINATION lib COMPONENT libs NAMELINK_SKIP) diff --git a/Tests/RunCMake/CPack/DEPENDENCIES.cmake b/Tests/RunCMake/CPack/DEPENDENCIES.cmake deleted file mode 100644 index 4499a7a..0000000 --- a/Tests/RunCMake/CPack/DEPENDENCIES.cmake +++ /dev/null @@ -1,18 +0,0 @@ -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") -add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") -add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -target_link_libraries(test_prog test_lib) - -install(TARGETS test_prog DESTINATION foo COMPONENT applications) -install(TARGETS test_prog DESTINATION foo_auto COMPONENT applications_auto) -install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) -install(TARGETS test_lib DESTINATION bas COMPONENT libs) -install(TARGETS test_lib DESTINATION bas_auto COMPONENT libs_auto) diff --git a/Tests/RunCMake/CPack/EMPTY_DIR.cmake b/Tests/RunCMake/CPack/EMPTY_DIR.cmake deleted file mode 100644 index 7bec17d..0000000 --- a/Tests/RunCMake/CPack/EMPTY_DIR.cmake +++ /dev/null @@ -1,2 +0,0 @@ -install(DIRECTORY DESTINATION empty - COMPONENT test) diff --git a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake b/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake deleted file mode 100644 index 9b3e856..0000000 --- a/Tests/RunCMake/CPack/INSTALL_SCRIPTS.cmake +++ /dev/null @@ -1,24 +0,0 @@ -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - -# default -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" - "echo \"pre install\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" - "echo \"post install\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" - "echo \"pre uninstall\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" - "echo \"post uninstall\"\n") - -# specific -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" - "echo \"pre install foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" - "echo \"post install foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" - "echo \"pre uninstall foo\"\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" - "echo \"post uninstall foo\"\n") - -install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) -install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) diff --git a/Tests/RunCMake/CPack/LONG_FILENAMES.cmake b/Tests/RunCMake/CPack/LONG_FILENAMES.cmake deleted file mode 100644 index 3370a50..0000000 --- a/Tests/RunCMake/CPack/LONG_FILENAMES.cmake +++ /dev/null @@ -1,8 +0,0 @@ -set(LONG_FILENAME - "${CMAKE_CURRENT_BINARY_DIR}/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") - -file(WRITE - "${LONG_FILENAME}" - "long_filename_test") - -install(FILES ${LONG_FILENAME} DESTINATION foo) diff --git a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake b/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake deleted file mode 100644 index f2c4451..0000000 --- a/Tests/RunCMake/CPack/MAIN_COMPONENT.cmake +++ /dev/null @@ -1,12 +0,0 @@ -set(CPACK_RPM_COMPONENT_INSTALL "ON") - -install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications) -install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) -install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs) - -if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") - set(CPACK_RPM_MAIN_COMPONENT "") -else() - set(CPACK_RPM_MAIN_COMPONENT "applications") - set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") -endif() diff --git a/Tests/RunCMake/CPack/MINIMAL.cmake b/Tests/RunCMake/CPack/MINIMAL.cmake deleted file mode 100644 index 83ed0f2..0000000 --- a/Tests/RunCMake/CPack/MINIMAL.cmake +++ /dev/null @@ -1 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) diff --git a/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake b/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake deleted file mode 100644 index 0838063..0000000 --- a/Tests/RunCMake/CPack/PACKAGE_CHECKSUM.cmake +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo) - -set(CPACK_PACKAGE_CHECKSUM ${RunCMake_SUBTEST_SUFFIX}) diff --git a/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake deleted file mode 100644 index 31e729b..0000000 --- a/Tests/RunCMake/CPack/PARTIALLY_RELOCATABLE_WARNING.cmake +++ /dev/null @@ -1,6 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static) - -set(CPACK_PACKAGE_RELOCATABLE TRUE) -set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") - -set(CPACK_RPM_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake b/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake deleted file mode 100644 index 703c1b7..0000000 --- a/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) -install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) -install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) diff --git a/Tests/RunCMake/CPack/RPM_DIST.cmake b/Tests/RunCMake/CPack/RPM_DIST.cmake deleted file mode 100644 index 6bdd2c0..0000000 --- a/Tests/RunCMake/CPack/RPM_DIST.cmake +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) - -set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) diff --git a/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake b/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake deleted file mode 100644 index dc90ae8..0000000 --- a/Tests/RunCMake/CPack/RPM_SUGGESTS.cmake +++ /dev/null @@ -1,3 +0,0 @@ -install(FILES CMakeLists.txt DESTINATION foo) - -set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") diff --git a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake b/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake deleted file mode 100644 index 60e9038..0000000 --- a/Tests/RunCMake/CPack/SINGLE_DEBUGINFO.cmake +++ /dev/null @@ -1,54 +0,0 @@ -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - -# PGI compiler doesn't add build id to binaries by default -if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") - string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") - string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") -endif() - -if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") - set(CPACK_RPM_COMPONENT_INSTALL "ON") -endif() - -set(CMAKE_BUILD_TYPE Debug) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" - "int test_lib();\n") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" - "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") -add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") -add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") -target_link_libraries(test_prog test_lib) - -install(TARGETS test_prog DESTINATION foo COMPONENT applications) - -if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") - install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) - install(TARGETS test_lib DESTINATION bas COMPONENT libs) -elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") - set(CPACK_COMPONENTS_ALL applications) -endif() - -set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON) - -if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") - set(CPACK_RPM_MAIN_COMPONENT "applications") - set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") -endif() - -if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" - OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component") - set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) - set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) -endif() - -set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") diff --git a/Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake b/Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake deleted file mode 100644 index 359b98f..0000000 --- a/Tests/RunCMake/CPack/SOURCE_PACKAGE.cmake +++ /dev/null @@ -1,7 +0,0 @@ -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" - "int main() {return 0;}\n") -add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") - -install(TARGETS test_prog DESTINATION foo COMPONENT applications) - -set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") diff --git a/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake new file mode 100644 index 0000000..9cd91af --- /dev/null +++ b/Tests/RunCMake/CPack/tests/COMPONENTS_EMPTY_DIR/test.cmake @@ -0,0 +1,3 @@ +set(CPACK_COMPONENTS_ALL test) +install(DIRECTORY DESTINATION empty + COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake new file mode 100644 index 0000000..115864f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake @@ -0,0 +1,5 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake new file mode 100644 index 0000000..70b3cb3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -0,0 +1,32 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# PGI compiler doesn't add build id to binaries by default +if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") + string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") +endif() + +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CMAKE_BUILD_TYPE Debug) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(TARGETS test_lib DESTINATION bas COMPONENT libs) + +set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) +set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) + +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") diff --git a/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake b/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake new file mode 100644 index 0000000..754561d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_EXTRA/test.cmake @@ -0,0 +1,38 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT bas) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/preinst "echo default_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp/prerm "echo default_prerm") + +foreach(file_ preinst prerm) + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tmp/${file_} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR} + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) +endforeach() + +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/preinst;${CMAKE_CURRENT_BINARY_DIR}/prerm;${CMAKE_CURRENT_BINARY_DIR}/conffiles") + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/preinst "echo bar_preinst") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/prerm "echo bar_prerm") + +foreach(file_ preinst prerm) + # not acceptable permissions for lintian but we need to check that + # permissions are preserved + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/bar_tmp/${file_} + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bar + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE) +endforeach() + +set(CPACK_DEBIAN_BAR_PACKAGE_CONTROL_EXTRA + "${CMAKE_CURRENT_BINARY_DIR}/bar/preinst;${CMAKE_CURRENT_BINARY_DIR}/bar/prerm") + +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + +set(CPACK_DEB_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake new file mode 100644 index 0000000..fa0bc35 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS/test.cmake @@ -0,0 +1,16 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") +set_target_properties(test_lib PROPERTIES SOVERSION "0.8") + +install(TARGETS test_lib DESTINATION foo COMPONENT libs) diff --git a/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake new file mode 100644 index 0000000..2fc9e23 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEB_GENERATE_SHLIBS_LDCONFIG/test.cmake @@ -0,0 +1,17 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") +set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS "ON") +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=") + +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") +set_target_properties(test_lib PROPERTIES SOVERSION "0.8") + +install(TARGETS test_lib LIBRARY DESTINATION lib COMPONENT libs NAMELINK_SKIP) diff --git a/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake new file mode 100644 index 0000000..4499a7a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DEPENDENCIES/test.cmake @@ -0,0 +1,18 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) +install(TARGETS test_prog DESTINATION foo_auto COMPONENT applications_auto) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(TARGETS test_lib DESTINATION bas COMPONENT libs) +install(TARGETS test_lib DESTINATION bas_auto COMPONENT libs_auto) diff --git a/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake new file mode 100644 index 0000000..7bec17d --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EMPTY_DIR/test.cmake @@ -0,0 +1,2 @@ +install(DIRECTORY DESTINATION empty + COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake new file mode 100644 index 0000000..9b3e856 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/INSTALL_SCRIPTS/test.cmake @@ -0,0 +1,24 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# default +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install.sh" + "echo \"pre install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install.sh" + "echo \"post install\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall.sh" + "echo \"pre uninstall\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall.sh" + "echo \"post uninstall\"\n") + +# specific +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_install_foo.sh" + "echo \"pre install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_install_foo.sh" + "echo \"post install foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pre_uninstall_foo.sh" + "echo \"pre uninstall foo\"\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/post_uninstall_foo.sh" + "echo \"post uninstall foo\"\n") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT foo) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT bar) diff --git a/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake new file mode 100644 index 0000000..3370a50 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/LONG_FILENAMES/test.cmake @@ -0,0 +1,8 @@ +set(LONG_FILENAME + "${CMAKE_CURRENT_BINARY_DIR}/llllllllll_oooooooooo_nnnnnnnnnn_gggggggggg_ffffffffff_iiiiiiiiii_llllllllll_eeeeeeeeee_nnnnnnnnnn_aaaaaaaaaa_mmmmmmmmmm_eeeeeeeeee.txt") + +file(WRITE + "${LONG_FILENAME}" + "long_filename_test") + +install(FILES ${LONG_FILENAME} DESTINATION foo) diff --git a/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake new file mode 100644 index 0000000..f2c4451 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/MAIN_COMPONENT/test.cmake @@ -0,0 +1,12 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +install(FILES CMakeLists.txt DESTINATION foo COMPONENT applications) +install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) +install(FILES CMakeLists.txt DESTINATION bas COMPONENT libs) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid") + set(CPACK_RPM_MAIN_COMPONENT "") +else() + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() diff --git a/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake new file mode 100644 index 0000000..83ed0f2 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/MINIMAL/test.cmake @@ -0,0 +1 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) diff --git a/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake new file mode 100644 index 0000000..0838063 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PACKAGE_CHECKSUM/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_PACKAGE_CHECKSUM ${RunCMake_SUBTEST_SUFFIX}) diff --git a/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake new file mode 100644 index 0000000..31e729b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PARTIALLY_RELOCATABLE_WARNING/test.cmake @@ -0,0 +1,6 @@ +install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static) + +set(CPACK_PACKAGE_RELOCATABLE TRUE) +set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") + +set(CPACK_RPM_COMPONENT_INSTALL ON) diff --git a/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake new file mode 100644 index 0000000..703c1b7 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PER_COMPONENT_FIELDS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) diff --git a/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake b/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake new file mode 100644 index 0000000..6bdd2c0 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/RPM_DIST/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) diff --git a/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake new file mode 100644 index 0000000..dc90ae8 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/RPM_SUGGESTS/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) + +set(CPACK_RPM_PACKAGE_SUGGESTS "libsuggested") diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake new file mode 100644 index 0000000..60e9038 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/test.cmake @@ -0,0 +1,54 @@ +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + +# PGI compiler doesn't add build id to binaries by default +if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI") + string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") + string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") +endif() + +if(NOT RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") + set(CPACK_RPM_COMPONENT_INSTALL "ON") +endif() + +set(CMAKE_BUILD_TYPE Debug) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" + "int test_lib();\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" + "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") +add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "#include \"test_lib.hpp\"\nint main() {return test_lib();}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +target_link_libraries(test_prog test_lib) + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + install(FILES CMakeLists.txt DESTINATION bar COMPONENT headers) + install(TARGETS test_lib DESTINATION bas COMPONENT libs) +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") + set(CPACK_COMPONENTS_ALL applications) +endif() + +set(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE ON) + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_debuginfo") + set(CPACK_RPM_MAIN_COMPONENT "applications") + set(CPACK_RPM_APPLICATIONS_FILE_NAME "RPM-DEFAULT") +endif() + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_main_component" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component") + set(CPACK_RPM_APPLICATIONS_DEBUGINFO_PACKAGE ON) + set(CPACK_RPM_LIBS_DEBUGINFO_PACKAGE ON) +endif() + +set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/src") diff --git a/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake new file mode 100644 index 0000000..359b98f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/SOURCE_PACKAGE/test.cmake @@ -0,0 +1,7 @@ +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" + "int main() {return 0;}\n") +add_executable(test_prog "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") + +install(TARGETS test_prog DESTINATION foo COMPONENT applications) + +set(CPACK_RPM_FILE_NAME "RPM-DEFAULT") -- cgit v0.12