From 6fa362022252e3e74bc3353cbb0089de44b83d77 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 17 Aug 2023 13:59:48 +0100 Subject: [PATCH] CMake: Change -ffile-prefix-map to be enabled by an option Use in github release workflows --- .github/workflows/release-linux-distros.yml | 1 + .github/workflows/release-linux.yml | 1 + .github/workflows/release-macos.yml | 2 ++ cmake/CompileFlags.cmake | 6 +++++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-linux-distros.yml b/.github/workflows/release-linux-distros.yml index 0b488e87ca..817291d112 100644 --- a/.github/workflows/release-linux-distros.yml +++ b/.github/workflows/release-linux-distros.yml @@ -95,6 +95,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DOPTION_COMPRESS_DEBUG=ON \ -DOPTION_LTO=ON \ + -DOPTION_TRIM_PATH_PREFIX=ON \ -DCMAKE_INSTALL_PREFIX=/usr \ # EOF echo "::endgroup::" diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 53f7e774f4..f241b8fee3 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -138,6 +138,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DOPTION_COMPRESS_DEBUG=ON \ -DOPTION_LTO=ON \ + -DOPTION_TRIM_PATH_PREFIX=ON \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DOPTION_PACKAGE_DEPENDENCIES=ON \ # EOF diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index 768964aa35..702d57bac9 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -112,6 +112,7 @@ jobs: -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DCMAKE_BUILD_TYPE=Release \ + -DOPTION_TRIM_PATH_PREFIX=ON \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ # EOF echo "::endgroup::" @@ -133,6 +134,7 @@ jobs: -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DCMAKE_BUILD_TYPE=Release \ + -DOPTION_TRIM_PATH_PREFIX=ON \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DCPACK_BUNDLE_APPLE_CERT_APP=${{ secrets.APPLE_DEVELOPER_CERTIFICATE_ID }} \ "-DCPACK_BUNDLE_APPLE_CODESIGN_PARAMETER=--deep -f --options runtime" \ diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index e7bd698104..3eaeee10db 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -93,9 +93,13 @@ macro(compile_flags) # compiler all happy. -fno-strict-aliasing - "-ffile-prefix-map=${CMAKE_SOURCE_DIR}/=/" + ) + if(OPTION_TRIM_PATH_PREFIX) + add_compile_options("-ffile-prefix-map=${CMAKE_SOURCE_DIR}/=/") + endif(OPTION_TRIM_PATH_PREFIX) + if(NOT CMAKE_BUILD_TYPE) # Sensible default if no build type specified add_compile_options(-O2)