Skip to content

Make HyTeG usable via `add_subdirectory(hyteg)`

Daniel Bauer requested to merge bauerd/cmake into master

This MR replaces all occurences of CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR with CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR, respectively. As a result external projects can integrate HyTeG using add_subdirectory(hyteg).

MWE:

cmake_minimum_required(VERSION 3.20)
project(hyteg_integration_tests)

list(APPEND WALBERLA_MODULE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/hyteg/src" "${CMAKE_CURRENT_SOURCE_DIR}/hyteg/tests")
add_subdirectory(hyteg)
waLBerla_import()

# add a convenience interface target to link against
add_library(hyteg::hyteg INTERFACE IMPORTED)
set_target_properties(hyteg::hyteg PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/hyteg/src"
  INTERFACE_LINK_DIRECTORIES "${hyteg_LIBRARY_DIR}"
  INTERFACE_LINK_LIBRARIES hyteg
)

add_subdirectory(src)

Merge request reports