mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Fix issue where exports failed when no libraries
Currently, the only library created is for the rendering package. If VTKm_BUILD_RENDERING is off, then no libraries are created. If no libraries are created, then there is nothing that declares a VTKmTargets export. If there is nothing that creates a VTKmTargets export, the export command fails. Aaarg!!!! I can't even find a way to query whether an export is valid (in the same way you can query whether a target exists). I added a global variable that recorded whether vtkm_library added a library (where things are added to the VTKmTargets export). The export command is called if any libraries were created, a stub is created and installed otherwise.
This commit is contained in:
parent
74aeeaa66b
commit
434f54195a
@ -577,6 +577,7 @@ function(vtkm_wrap_sources_for_cuda cuda_source_list_var)
|
||||
set(${cuda_source_list_var} ${cuda_sources} PARENT_SCOPE)
|
||||
endfunction(vtkm_wrap_sources_for_cuda)
|
||||
|
||||
set(VTKM_HAS_AT_LEAST_ONE_LIBRARY FALSE CACHE INTERNAL "" FORCE)
|
||||
# Add a VTK-m library. The name of the library will match the "kit" name
|
||||
# (e.g. vtkm_rendering) unless the NAME argument is given.
|
||||
#
|
||||
@ -665,6 +666,7 @@ function(vtkm_library)
|
||||
vtkm_install_headers("${dir_prefix}"
|
||||
${CMAKE_BINARY_DIR}/${VTKm_INSTALL_INCLUDE_DIR}/${dir_prefix}/${lib_name}_export.h
|
||||
)
|
||||
set(VTKM_HAS_AT_LEAST_ONE_LIBRARY TRUE CACHE INTERNAL "" FORCE)
|
||||
endfunction(vtkm_library)
|
||||
|
||||
# The Thrust project is not as careful as the VTKm project in avoiding warnings
|
||||
|
@ -335,14 +335,22 @@ install(
|
||||
)
|
||||
|
||||
# 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
|
||||
)
|
||||
|
||||
if(${VTKM_HAS_AT_LEAST_ONE_LIBRARY})
|
||||
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
|
||||
)
|
||||
else() # No libraries built
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
|
||||
"# This build of VTK-m has no libraries to export targets for"
|
||||
)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/${VTKm_INSTALL_CONFIG_DIR}/VTKmTargets.cmake
|
||||
DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Enable CPack packaging
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${VTKm_SOURCE_DIR}/README.md)
|
||||
|
Loading…
Reference in New Issue
Block a user