Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export targets and make sure they can be used by other projects #177

Merged
merged 6 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,9 @@ MESSAGE( STATUS "" )
GENERATE_PACKAGE_CONFIGURATION_FILES( LCIOConfig.cmake LCIOConfigVersion.cmake )

INSTALL( FILES cmake/MacroCheckPackageLibs.cmake cmake/MacroCheckPackageVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)

install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE ${PROJECT_NAME}::
FILE "${PROJECT_NAME}Targets.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/"
)
6 changes: 6 additions & 0 deletions cmake/LCIOConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ CHECK_PACKAGE_LIBS( LCIO lcio @CHECK_PACKAGE_SIO_LIBRARY@ )
## ---------------------------------------------------------------


include(CMakeFindDependencyMacro)
find_dependency(SIO)
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved

# Include the targets file to create the imported targets that a client can link
# to or execute
include("${CMAKE_CURRENT_LIST_DIR}/LCIOTargets.cmake")


# ---------- final checking ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions cmake/MacroGeneratePackageConfigFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MACRO( GENERATE_PACKAGE_CONFIGURATION_FILES )
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/cmake/${arg}.in"
"${PROJECT_BINARY_DIR}/${arg}" @ONLY
)
INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION . )
INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} )
#IF( EXISTS "${_current_dir}/MacroCheckPackageLibs.cmake" )
# INSTALL( FILES "${_current_dir}/MacroCheckPackageLibs.cmake" DESTINATION cmake )
#ENDIF()
Expand All @@ -26,7 +26,7 @@ MACRO( GENERATE_PACKAGE_CONFIGURATION_FILES )
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/cmake/${arg}.in"
"${PROJECT_BINARY_DIR}/${arg}" @ONLY
)
INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION . )
INSTALL( FILES "${PROJECT_BINARY_DIR}/${arg}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} )
#IF( EXISTS "${_current_dir}/MacroCheckPackageVersion.cmake" )
# INSTALL( FILES "${_current_dir}/MacroCheckPackageVersion.cmake" DESTINATION cmake )
#ENDIF()
Expand Down
1 change: 1 addition & 0 deletions cmake/MacroInstallSharedLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MACRO( INSTALL_SHARED_LIBRARY )

# install library
INSTALL( TARGETS ${ARGN}
EXPORT LCIOTargets
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
Expand Down
1 change: 1 addition & 0 deletions sio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ TARGET_INCLUDE_DIRECTORIES( sio PUBLIC
TARGET_INCLUDE_DIRECTORIES( sio SYSTEM PUBLIC ${ZLIB_INCLUDE_DIR} )
TARGET_LINK_LIBRARIES( sio ${ZLIB_LIBRARIES} )
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved
INSTALL_SHARED_LIBRARY( sio DESTINATION ${CMAKE_INSTALL_LIBDIR} )
ADD_LIBRARY( SIO::sio ALIAS sio )

# Install the sio headers as well. Necessary for the python bindings and also
# for cases where others want to link against LCIO / this version of SIO
Expand Down
1 change: 1 addition & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ TARGET_LINK_LIBRARIES( lcio ${CMAKE_THREAD_LIBS_INIT} )
TARGET_LINK_LIBRARIES( lcio ${SIO_LIBRARIES} )
jmcarcell marked this conversation as resolved.
Show resolved Hide resolved

ADD_CUSTOM_TARGET( lib DEPENDS lcio )
ADD_LIBRARY( LCIO::lcio ALIAS lcio )
# ----------------------------------------------------------------------------


Expand Down