diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,8 +45,9 @@ add_custom_target(check-upgrade-activated) add_custom_target(check-upgrade-activated-extended) -# Add the global install target +# Add the global install targets add_custom_target(install-all) +add_custom_target(install-debug) include(PackageHelper) exclude_git_ignored_files_from_source_package() diff --git a/cmake/modules/InstallationHelper.cmake b/cmake/modules/InstallationHelper.cmake --- a/cmake/modules/InstallationHelper.cmake +++ b/cmake/modules/InstallationHelper.cmake @@ -10,6 +10,8 @@ add_custom_target(${INSTALL_TARGET} COMMENT "Installing component ${COMPONENT}" COMMAND + "${CMAKE_COMMAND}" + -E env CMAKE_INSTALL_ALWAYS=ON "${CMAKE_COMMAND}" -DCOMPONENT="${COMPONENT}" -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" @@ -26,6 +28,25 @@ if(ARGN) add_dependencies(${INSTALL_TARGET} ${ARGN}) endif() + + if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT TARGET "install-${COMPONENT}-debug") + add_custom_target("install-${COMPONENT}-debug" + COMMENT "Splitting out the debug symbols for component ${COMPONENT}" + COMMAND + "${CMAKE_SOURCE_DIR}/cmake/utils/split-installed-component.sh" + "${CMAKE_BINARY_DIR}/contrib/devtools/split-debug.sh" + "${CMAKE_BINARY_DIR}/install_manifest_${COMPONENT}.txt" + DEPENDS + "${INSTALL_TARGET}" + "${CMAKE_BINARY_DIR}/contrib/devtools/split-debug.sh" + ) + endif() + + if(TARGET install-debug) + add_dependencies(install-debug "install-${COMPONENT}-debug") + endif() + endif() endfunction() function(install_target _target) diff --git a/cmake/utils/split-installed-component.sh b/cmake/utils/split-installed-component.sh new file mode 100755 --- /dev/null +++ b/cmake/utils/split-installed-component.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +export LC_ALL=C.UTF-8 + +SPLIT_SCRIPT="$1" +INSTALL_MANIFEST="$2" + +while IFS= read -r FILE || [ -n "$FILE" ] +do + if [ ! -L "${FILE}" ] && [ -x "${FILE}" ] + then + echo "Splitting debug symbols out of ${FILE}" + "${SPLIT_SCRIPT}" "${FILE}" "${FILE}" "${FILE}.dbg" > /dev/null 2>&1 + fi +done < "${INSTALL_MANIFEST}"