Skip to content

Commit

Permalink
Split Targets and Config and add find_package
Browse files Browse the repository at this point in the history
Signed-off-by: Harry Mallon <[email protected]>
  • Loading branch information
hjmallon authored and cary-ilm committed Feb 27, 2020
1 parent 693eedc commit adf0e6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions IlmBase/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,21 @@ endif()
# moral equivalent of a pkg-config file for cmake
# and replaces the Find*.cmake of the "old" cmake
include(CMakePackageConfigHelpers)
configure_package_config_file(IlmBaseConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${ILMBASE_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
install(EXPORT ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
FILE ${PROJECT_NAME}Config.cmake
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
EXPORT_LINK_INTERFACE_LIBRARIES
)
4 changes: 4 additions & 0 deletions IlmBase/config/IlmBaseConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@PROJECT_NAME@")

0 comments on commit adf0e6b

Please sign in to comment.