From b0ba60acb549a4a277001434a6804577064ee7d5 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Wed, 7 Feb 2024 22:10:27 +0500 Subject: [PATCH] CMake: move packaging related stuff from utils.cmake to packaging.cmake --- cmake/packaging.cmake | 52 +++++++++++++++++++++++++++---------------- cmake/utils.cmake | 26 ---------------------- 2 files changed, 33 insertions(+), 45 deletions(-) diff --git a/cmake/packaging.cmake b/cmake/packaging.cmake index 9a59066fc47..b0593cd10c7 100644 --- a/cmake/packaging.cmake +++ b/cmake/packaging.cmake @@ -1,16 +1,39 @@ -if (UNIX) - if (EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") - set(CPACK_PACKAGE_VENDOR "OpenXRay Team") - set(CPACK_PACKAGE_CONTACT "OpenXRay ") - set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION}) +set(CPACK_PACKAGE_VENDOR "OpenXRay Team") +set(CPACK_PACKAGE_CONTACT "OpenXRay ") +set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION}) + +set(CPACK_PACKAGE_FILE_NAME "openxray-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_PROCESSOR}") - set(CPACK_PACKAGE_FILE_NAME "openxray-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_PROCESSOR}") +set(CPACK_STRIP_FILES TRUE) +set(CPACK_SOURCE_IGNORE_FILES "/.gitattributes") +set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md) +set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/License.txt) - set(CPACK_STRIP_FILES TRUE) - set(CPACK_SOURCE_IGNORE_FILES "/.gitattributes") - set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md) - set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/License.txt) +if (UNIX) + # Try to find specific OS files to determine type of linux distribution + find_file(FEDORA_FOUND fedora-release PATHS /etc) + find_file(REDHAT_FOUND redhat-release inittab.RH PATHS /etc) + find_file(CENTOS_FOUND centos-release PATHS /etc) + # If we found debian then we don't need to check further for ubuntu + # as it uses debian core. + find_file(DEBIAN_FOUND debian_version debconf.conf PATHS /etc) + + # -------------------------------------------------- + # Uninstall target + # -------------------------------------------------- + # To clean system folder from libraries and binaries + # that was installed with `sudo make install` + # just run `sudo make uninstall` + if (NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + endif() + if (exists "${CMAKE_ROOT}/Modules/CPack.cmake") # --- SELECT PROPER CPACK GENERATOR --- if (DEBIAN_FOUND) set(CPACK_GENERATOR DEB) @@ -37,12 +60,3 @@ if (UNIX) include(CPack) endif() endif() - -# TODO: Need to be implemented in future -if (WIN32) - #set(CPACK_GENERATOR NSIS) -endif() - -if (APPLE) - #set(CPACK_GENERATOR "DRAGNDROP") -endif() diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 2a052b011f6..9262a7993bf 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -31,32 +31,6 @@ else (CMAKE_SIZEOF_VOID_P EQUAL 4) set(ARCH_TYPE x86) endif() -# Unix system configuration -if (UNIX) - # Try to find specific OS files to determine type of linux distribution - find_file(FEDORA_FOUND fedora-release PATHS /etc) - find_file(REDHAT_FOUND redhat-release inittab.RH PATHS /etc) - find_file(CENTOS_FOUND centos-release PATHS /etc) - # If we found debian then we don't need to check further for ubuntu - # as it uses debian core. - find_file(DEBIAN_FOUND debian_version debconf.conf PATHS /etc) - - # -------------------------------------------------- - # Uninstall target - # -------------------------------------------------- - # To clean system folder from libraries and binaries - # that was installed with `sudo make install` - # just run `sudo make uninstall` - if (NOT TARGET uninstall) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) - - add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) - endif() -endif() - function(set_git_info) execute_process(COMMAND git rev-parse --verify HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"