From b4b4cb4bb78244f712916e301f482aad37c6dbb5 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Fri, 22 Nov 2024 15:09:06 -0500 Subject: [PATCH] Enhance ICU build configuration to use ccache as a compiler wrapper for improved performance --- cmake/BuildICU.cmake | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/cmake/BuildICU.cmake b/cmake/BuildICU.cmake index 48e0b2c..f3ce5f5 100644 --- a/cmake/BuildICU.cmake +++ b/cmake/BuildICU.cmake @@ -52,8 +52,9 @@ else() find_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) message(STATUS "Found ccache: ${CCACHE_PROGRAM}") - set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + # Create compiler wrapper commands + set(C_LAUNCHER "${CCACHE_PROGRAM} ${CMAKE_C_COMPILER}") + set(CXX_LAUNCHER "${CCACHE_PROGRAM} ${CMAKE_CXX_COMPILER}") endif() set(ICU_URL @@ -63,20 +64,11 @@ else() if(APPLE) set(ICU_PLATFORM "MacOSX") set(TARGET_ARCH -arch\ $ENV{MACOS_ARCH}) - set(ICU_BUILD_ENV_VARS - CFLAGS=${TARGET_ARCH} - CXXFLAGS=${TARGET_ARCH} - LDFLAGS=${TARGET_ARCH} - CC="${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}" - CXX="${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}") + set(ICU_BUILD_ENV_VARS CFLAGS=${TARGET_ARCH} CXXFLAGS=${TARGET_ARCH} LDFLAGS=${TARGET_ARCH} CC=${C_LAUNCHER} + CXX=${CXX_LAUNCHER}) else() set(ICU_PLATFORM "Linux") - set(ICU_BUILD_ENV_VARS - CFLAGS=-fPIC - CXXFLAGS=-fPIC - LDFLAGS=-fPIC - CC="${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER}" - CXX="${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER}") + set(ICU_BUILD_ENV_VARS CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-fPIC CC=${C_LAUNCHER} CXX=${CXX_LAUNCHER}) endif() ExternalProject_Add(