Skip to content

Commit

Permalink
AliMDC: CMake does not support static linked libraries, dependecies n…
Browse files Browse the repository at this point in the history
…eed to be set manually

CMake offers support for static only for executables, otherwise
it does not follow dependecies, all objects have to be manually set
  • Loading branch information
agrigora committed Mar 4, 2015
1 parent 01008a5 commit 6b82021
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions RAW/alimdc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ install(TARGETS ${MODULE} RUNTIME DESTINATION bin)

# Creating the AliMDC static library and the rpm
if(MDCRPM)
add_library(AliMDC STATIC $<TARGET_OBJECTS:${MODULE}-object>)
add_library(AliMDC STATIC $<TARGET_OBJECTS:${MODULE}-object> $<TARGET_OBJECTS:MDC-object> $<TARGET_OBJECTS:RAWDatarec-object> $<TARGET_OBJECTS:RAWDatabase-object> $<TARGET_OBJECTS:ESD-object> $<TARGET_OBJECTS:STEERBase-object>)

# list of shared dependencies / the name of the variable containing the list of static ones
generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
target_link_libraries(AliMDC ${STATIC_ALIROOT_DEPENDENCIES} Root RootExtra)

set_target_properties(AliMDC PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
set_target_properties(AliMDC PROPERTIES LINK_FLAGS "-Wl,--whole-archive -Wl,--no-as-needed")

# Installation
install(TARGETS AliMDC
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeALICE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ macro(generateDA DETECTOR ALGORITHM STATIC_DEPENDENCIES)
target_link_libraries(${DETECTOR}${ALGORITHM}da.exe ${STATIC_DEPENDENCIES} ${AMORE_AUXLIBS} daqDA ${DATE_MONLIBRARIES} ${DATE_RCPROXYLIBRARIES} Root RootExtra) # 1

# different flags
set(MODULE_COMPILE_FLAGS " ${DATE_CFLAGS} ${AMORE_CFLAGS}")
set(MODULE_COMPILE_FLAGS "-Wl,--no-as-needed ${DATE_CFLAGS} ${AMORE_CFLAGS}")
set(MODULE_LINK_FLAGS "${DATE_LDFLAGS} ${AMORE_STATICLIBS}")

set_target_properties(${DETECTOR}${ALGORITHM}da.exe PROPERTIES COMPILE_FLAGS ${MODULE_COMPILE_FLAGS})
Expand Down

0 comments on commit 6b82021

Please sign in to comment.