Commit cd17a82e authored by Alexy Pellegrini's avatar Alexy Pellegrini
Browse files

Add support for out-of-tree build using CMake

Add support for find_package(vespa):

```
find_package(vespa REQUIRED)
add_executable(vespatest main.cpp)
target_link_libraries(vespatest PRIVATE ${VTK_LIBRARIES} vtkCGALAlgorithm)
vtk_module_autoinit(...)
```
parent 2d043935
Pipeline #308836 passed with stages
in 31 minutes and 19 seconds
@PACKAGE_INIT@
set(VESPA_VTK_DIR "@VTK_DIR@")
if(NOT VTK_FOUND)
find_dependency(VTK PATHS "${VESPA_VTK_DIR}")
else()
get_filename_component(tmp1 "${VESPA_VTK_DIR}" REALPATH)
get_filename_component(tmp2 "${VTK_DIR}" REALPATH)
if(NOT "${tmp1}" STREQUAL "${tmp2}")
message(WARNING
"Mismatch for VTK between vespa and current project: "
"VTK_VESPA_DIR=${VESPA_VTK_DIR} "
"VTK_DIR=${VTK_DIR}")
endif()
endif()
set(VESPA_CGAL_DIR "@CGAL_DIR@")
if(NOT CGAL_FOUND)
find_dependency(CGAL PATHS "${VESPA_CGAL_DIR}")
else()
get_filename_component(tmp1 "${VESPA_CGAL_DIR}" REALPATH)
get_filename_component(tmp2 "${CGAL_DIR}" REALPATH)
if(NOT "${tmp1}" STREQUAL "${tmp2}")
message(WARNING
"Mismatch for CGAL between vespa and current project: "
"CGAL_VESPA_DIR=${VESPA_CGAL_DIR} "
"CGAL_DIR=${CGAL_DIR}")
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/vespa-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vespa-vtk-module-properties.cmake")
cmake_minimum_required(VERSION 3.8)
project(vespa)
project(vespa VERSION 0.1.0)
## Config
......@@ -79,16 +79,26 @@ vtk_module_build(
## Install
set(vespaExport ${vtkcgal_provided_modules})
export(
TARGETS ${vespaExport}
NAMESPACE VTK::
FILE "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/vespa/vespa-targets.cmake")
install(
EXPORT vespa
NAMESPACE VTK::
FILE vespa-targets.cmake
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/vespa")
include(CMakePackageConfigHelpers)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/CMake/vespa.cmake.in
${PROJECT_BINARY_DIR}/vespa-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vespa
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/vespa-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(
FILES ${CMAKE_BINARY_DIR}/vespa-config.cmake
${CMAKE_BINARY_DIR}/vespa-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vespa
COMPONENT development)
## ParaView plugin
## ---------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment