Skip to content

Commit

Permalink
Convert VendoredMD5 to an OBJECT library
Browse files Browse the repository at this point in the history
This is so that md5 gets "baked in" to libjana.{so,a}, rather than producing a separate install artifact
  • Loading branch information
nathanwbrei committed Dec 8, 2024
1 parent 26e270b commit 61be758
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/external/md5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

add_library(VendoredMD5 STATIC md5.c)
add_library(VendoredMD5 OBJECT md5.c)
target_include_directories(VendoredMD5 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)


Expand Down
6 changes: 3 additions & 3 deletions src/libraries/JANA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
target_link_libraries(jana2 PUBLIC ${CMAKE_DL_LIBS} Threads::Threads)
target_link_libraries(jana2 PRIVATE VendoredTomlPlusPlus)
target_link_libraries(jana2 PRIVATE VendoredMD5)
target_link_libraries(jana2 PRIVATE VendoredMD5) # To pull in the header file

if (${USE_PODIO})
target_link_libraries(jana2 PUBLIC podio::podio podio::podioRootIO ${ROOT_LIBRARIES})
Expand All @@ -79,7 +79,7 @@ endif()


# static library, always there
add_library(jana2_static_lib STATIC $<TARGET_OBJECTS:jana2>)
add_library(jana2_static_lib STATIC $<TARGET_OBJECTS:jana2> $<TARGET_OBJECTS:VendoredMD5>)
set_target_properties(jana2_static_lib PROPERTIES PREFIX "lib" OUTPUT_NAME "JANA")

target_include_directories(jana2_static_lib PUBLIC $<INSTALL_INTERFACE:include>)
Expand All @@ -96,7 +96,7 @@ install(TARGETS jana2_static_lib EXPORT jana2_targets DESTINATION lib)
# optionally build shared lib
if (BUILD_SHARED_LIBS)
message(STATUS "Building both shared and static libraries")
add_library(jana2_shared_lib SHARED $<TARGET_OBJECTS:jana2>)
add_library(jana2_shared_lib SHARED $<TARGET_OBJECTS:jana2> $<TARGET_OBJECTS:VendoredMD5>)
set_target_properties(jana2_shared_lib PROPERTIES PREFIX "lib" OUTPUT_NAME "JANA")

target_include_directories(jana2_shared_lib PUBLIC $<INSTALL_INTERFACE:include>)
Expand Down
2 changes: 1 addition & 1 deletion src/programs/jana/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
add_executable(jana jana.cc )

find_package(Threads REQUIRED)
target_link_libraries(jana jana2 Threads::Threads)
target_link_libraries(jana jana2_static_lib Threads::Threads)
target_link_options(jana PRIVATE -rdynamic)
install(TARGETS jana DESTINATION bin)

0 comments on commit 61be758

Please sign in to comment.