Skip to content

Commit 4afa537

Browse files
authored
Filter raw linker flags from GBL_LIBRARIES (#15162)
1 parent 78b931b commit 4afa537

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

dependencies/O2Dependencies.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,25 @@ find_package(GBL)
286286
set_package_properties(GBL PROPERTIES TYPE REQUIRED)
287287
if(GBL_FOUND AND NOT TARGET GBL::GBL)
288288
# As of now, GBL does not provide a cmake target so create a compatibility wrapper
289+
# also GBL_LIBRARIES contains raw linker flags to ROOT we need to filter out
290+
set(GBL_LIBRARIES_FILTERED "")
291+
set(GBL_LINK_OPTIONS "")
292+
foreach(_lib IN LISTS GBL_LIBRARIES)
293+
if(_lib MATCHES "^-[lL]")
294+
continue()
295+
elseif(_lib MATCHES "^-")
296+
list(APPEND GBL_LINK_OPTIONS "${_lib}")
297+
else()
298+
list(APPEND GBL_LIBRARIES_FILTERED "${_lib}")
299+
endif()
300+
endforeach()
289301
add_library(GBL::GBL INTERFACE IMPORTED)
290302
target_include_directories(GBL::GBL INTERFACE ${GBL_INCLUDE_DIR})
291303
target_link_libraries(GBL::GBL INTERFACE
292-
${GBL_LIBRARIES}
304+
${GBL_LIBRARIES_FILTERED}
293305
Eigen3::Eigen
294306
)
307+
target_link_options(GBL::GBL INTERFACE ${GBL_LINK_OPTIONS})
295308
endif()
296309

297310
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

0 commit comments

Comments
 (0)