From fb08a8eca5aa057dec6ec3617c9dbc09d729658d Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:49:49 +0200 Subject: [PATCH] Avoid recompiling fpu.cxx a gazillion of times This will simply link the object file from fpu.cxx, which will be compiled only once. --- Common/Utils/CMakeLists.txt | 3 +++ cmake/O2AddExecutable.cmake | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Common/Utils/CMakeLists.txt b/Common/Utils/CMakeLists.txt index def743d11791c..d9954e23ab435 100644 --- a/Common/Utils/CMakeLists.txt +++ b/Common/Utils/CMakeLists.txt @@ -91,3 +91,6 @@ o2_add_executable(treemergertool COMPONENT_NAME CommonUtils SOURCES src/TreeMergerTool.cxx PUBLIC_LINK_LIBRARIES O2::CommonUtils Boost::program_options ROOT::Core) + +add_library(fpu_support OBJECT src/fpu.cxx) +add_library(O2::fpu_support ALIAS fpu_support) diff --git a/cmake/O2AddExecutable.cmake b/cmake/O2AddExecutable.cmake index d5fea084e2c23..752678c44baf0 100644 --- a/cmake/O2AddExecutable.cmake +++ b/cmake/O2AddExecutable.cmake @@ -92,7 +92,7 @@ function(o2_add_executable baseTargetName) endif() # add the executable with its sources - add_executable(${target} ${A_SOURCES} ${CMAKE_SOURCE_DIR}/Common/Utils/src/fpu.cxx) + add_executable(${target} ${A_SOURCES}) # set the executable output name set_property(TARGET ${target} PROPERTY OUTPUT_NAME ${exeName}) @@ -118,6 +118,7 @@ function(o2_add_executable baseTargetName) # needed for fpu.c target_link_libraries(${target} PUBLIC ROOT::XMLIO) + target_link_libraries(${target} PUBLIC O2::fpu_support) if(NOT A_NO_INSTALL) # install the executable