Add target exports to installed files
This makes it much easier for dependent CMake projects to find the VTK-m libraries.
This commit is contained in:
parent
52838e9ed2
commit
74aeeaa66b
@ -52,9 +52,6 @@ if(VTKm_PACKAGE_IN_BUILD)
|
||||
set(VTKm_INCLUDE_DIRS ${VTKm_INCLUDE_DIRS} "@VTKm_SOURCE_DIR@")
|
||||
endif()
|
||||
|
||||
# Clear out the libraries. We will add more when loading components.
|
||||
set(VTKm_LIBRARIES)
|
||||
|
||||
set(VTKm_REQUIRED_BOOST_VERSION "@VTKm_REQUIRED_BOOST_VERSION@")
|
||||
|
||||
if(NOT VTKm_PACKAGE_IN_BUILD)
|
||||
@ -69,6 +66,15 @@ set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@")
|
||||
set(VTKm_ENABLE_OPENGL_INTEROP "@VTKm_ENABLE_OPENGL_INTEROP@")
|
||||
set(VTKm_BUILD_RENDERING "@VTKm_BUILD_RENDERING@")
|
||||
|
||||
# Load the library exports, but only if not compiling VTK-m itself
|
||||
set_and_check(VTKm_CONFIG_DIR "@PACKAGE_VTKm_INSTALL_CONFIG_DIR@")
|
||||
if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "@VTKm_BINARY_DIR@")
|
||||
include(${VTKm_CONFIG_DIR}/VTKmTargets.cmake)
|
||||
endif()
|
||||
|
||||
# Clear out the libraries. We will add more when loading components.
|
||||
set(VTKm_LIBRARIES)
|
||||
|
||||
# The VTKm variables used to configure components and packages silently.
|
||||
set(VTKm_CONFIGURE_QUIET "${VTKm_FIND_QUIETLY}")
|
||||
set(VTKm_FIND_PACKAGE_QUIETLY "")
|
||||
|
@ -657,6 +657,7 @@ function(vtkm_library)
|
||||
)
|
||||
|
||||
install(TARGETS ${lib_name}
|
||||
EXPORT ${VTKm_EXPORT_NAME}
|
||||
ARCHIVE DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
LIBRARY DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}
|
||||
|
@ -51,6 +51,8 @@ set(VTKm_INSTALL_LIB_DIR "lib")
|
||||
set(VTKm_INSTALL_BIN_DIR "bin")
|
||||
set(VTKm_INSTALL_CMAKE_MODULE_DIR "share/vtkm/cmake")
|
||||
|
||||
set(VTKm_EXPORT_NAME "VTKmTargets")
|
||||
|
||||
set(VTKm_REQUIRED_BOOST_VERSION "1.48")
|
||||
|
||||
set(VTKm_CMAKE_MODULE_PATH ${VTKm_SOURCE_DIR}/CMake)
|
||||
@ -283,7 +285,12 @@ configure_package_config_file(
|
||||
${VTKm_SOURCE_DIR}/CMake/VTKmConfig.cmake.in
|
||||
${VTKm_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmConfig.cmake
|
||||
INSTALL_DESTINATION ${VTKm_INSTALL_CONFIG_DIR}
|
||||
PATH_VARS VTKm_INSTALL_INCLUDE_DIR VTKm_INSTALL_CMAKE_MODULE_DIR
|
||||
PATH_VARS
|
||||
VTKm_INSTALL_INCLUDE_DIR
|
||||
VTKm_INSTALL_CONFIG_DIR
|
||||
VTKm_INSTALL_LIB_DIR
|
||||
VTKm_INSTALL_BIN_DIR
|
||||
VTKm_INSTALL_CMAKE_MODULE_DIR
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
@ -327,6 +334,14 @@ install(
|
||||
DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR}
|
||||
)
|
||||
|
||||
# Create and install exports for external projects
|
||||
export(EXPORT ${VTKm_EXPORT_NAME}
|
||||
FILE ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
|
||||
)
|
||||
install(EXPORT ${VTKm_EXPORT_NAME}
|
||||
DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
FILE VTKmTargets.cmake
|
||||
)
|
||||
|
||||
|
||||
# Enable CPack packaging
|
||||
|
Loading…
Reference in New Issue
Block a user