Skip to content

Commit

Permalink
Add a BUILD_INTERFACE and INSTALL_INTERFACE for edm4hep
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Nov 5, 2023
1 parent a36ee9a commit aa57af4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE
${CMAKE_CURRENT_SOURCE_DIR}/NOTICE
DESTINATION ${CMAKE_INSTALL_DOCDIR})


install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/edm4hep/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/edm4hep
FILES_MATCHING PATTERN "*.h")

find_package(nlohmann_json 3.10.5)

add_subdirectory(edm4hep)
Expand Down
7 changes: 7 additions & 0 deletions edm4hep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ PODIO_ADD_DATAMODEL_CORE_LIB(edm4hep "${headers}" "${sources}")
add_library(EDM4HEP::edm4hep ALIAS edm4hep)
set_target_properties(edm4hep PROPERTIES ALIAS_GLOBAL true)

file(GLOB_RECURSE top_headers ${PROJECT_SOURCE_DIR}/include/*.h)
target_sources(edm4hep PUBLIC FILE_SET headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/include FILES ${top_headers})
target_include_directories(edm4hep PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if (nlohmann_json_FOUND)
target_compile_definitions(edm4hep PUBLIC PODIO_JSON_OUTPUT)
target_link_libraries(edm4hep PUBLIC nlohmann_json::nlohmann_json)
Expand All @@ -29,6 +35,7 @@ install(TARGETS ${EDM4HEP_INSTALL_LIBS}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/edm4hep"
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT dev)

install(FILES
Expand Down

0 comments on commit aa57af4

Please sign in to comment.