From e587cc1990186b0cdb7e5ca946217f2865d28100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 16 Jan 2024 11:50:26 -0500 Subject: [PATCH] WIP: Create ANTSConfig.cmake Ref #1369. --- ANTS.cmake | 15 +++++++++++++++ Examples/CMakeLists.txt | 3 +++ 2 files changed, 18 insertions(+) diff --git a/ANTS.cmake b/ANTS.cmake index b66a41027..bd29e04d7 100644 --- a/ANTS.cmake +++ b/ANTS.cmake @@ -165,3 +165,18 @@ if(BUILD_SHARED_LIBS AND ((NOT USE_SYSTEM_ITK) OR ((NOT USE_SYSTEM_VTK) AND USE_ install(DIRECTORY ${CMAKE_BINARY_DIR}/../staging/${CMAKE_INSTALL_LIBDIR}/ DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() + +export(TARGETS ${ANTSTargets} FILE "${CMAKE_CURRENT_BINARY_DIR}/ANTS-targets.cmake") + +install(EXPORT antsTargets + FILE antsTargets.cmake + DESTINATION lib/cmake/ANTS) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "ANTSConfigVersion.cmake" + VERSION ${CPACK_PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion) + +install(FILES "ANTSConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ANTSConfigVersion.cmake" + DESTINATION lib/cmake/ANTS) diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 2fa76f6ac..8d564f815 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -21,6 +21,7 @@ install(TARGETS antsUtilities ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT DEVELOPMENT_antsUtilities ) +set(ANTSTargets antsUtilities) macro(STATIC_ANTS_BUILD ANTS_FUNCTION_NAME EXTRA_LIBS) set( ANTS_FUNCTION_NAME ${ANTS_FUNCTION_NAME} ) @@ -31,6 +32,7 @@ macro(STATIC_ANTS_BUILD ANTS_FUNCTION_NAME EXTRA_LIBS) message(STATUS "${ANTS_FUNCTION_NAME} ${EXTRA_LIBS}") target_link_libraries(l_${ANTS_FUNCTION_NAME} antsUtilities ${EXTRA_LIBS} ) configure_file( template_for_executables.cxx.in cli_${ANTS_FUNCTION_NAME}.cxx ) + list(APPEND ANTSTargets l_${ANTS_FUNCTION_NAME}) if (ANTS_INSTALL_LIBS_ONLY) install(TARGETS l_${ANTS_FUNCTION_NAME} @@ -65,6 +67,7 @@ macro(DYNAMIC_ANTS_BUILD ANTS_FUNCTION_NAME EXTRA_LIBS) message(STATUS "${ANTS_FUNCTION_NAME} ${EXTRA_LIBS}") target_link_libraries(l_${ANTS_FUNCTION_NAME} antsUtilities ${EXTRA_LIBS} ) configure_file( template_for_executables.cxx.in cli_${ANTS_FUNCTION_NAME}.cxx ) + list(APPEND ANTSTargets l_${ANTS_FUNCTION_NAME}) if (ANTS_INSTALL_LIBS_ONLY) install(TARGETS l_${ANTS_FUNCTION_NAME}