Use header-only target of c++utilities

The current approach even distinguished between the build and install
interface. However, CPP_UTILITIES_INCLUDE_DIRS is not correctly evaluated
at the time PUBLIC_INCLUDE_DIRS is populated here because the variable
PACKAGE_PREFIX_DIR from the c++utilities config module still points to the
build directory at build time and using $<INSTALL_INTERFACE:…> can not help
with that.
This commit is contained in:
Martchus 2021-01-01 18:48:14 +01:00
parent 6252a7335a
commit 5c49a438ad
2 changed files with 2 additions and 8 deletions

View File

@ -46,7 +46,7 @@ endif()
# find c++utilities
set(CONFIGURATION_PACKAGE_SUFFIX "" CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.10.0 REQUIRED)
# find RapidJSON
if(NOT RapidJSON_FOUND)

View File

@ -33,13 +33,7 @@ list(APPEND HEADER_FILES binary/reflector.h binary/reflector-boosthana.h binary/
list(APPEND TEST_SRC_FILES tests/traits.cpp tests/binaryreflector.cpp tests/binaryreflector-boosthana.cpp)
# add (only) the CMake module and include dirs for c++utilities because we're not depending on the actual library
list(APPEND CMAKE_MODULE_PATH ${CPP_UTILITIES_MODULE_DIRS})
if (CPP_UTILITIES_SOURCE_DIR)
list(APPEND PUBLIC_INCLUDE_DIRS $<BUILD_INTERFACE:${CPP_UTILITIES_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CPP_UTILITIES_INCLUDE_DIRS}>)
else ()
list(APPEND PUBLIC_INCLUDE_DIRS "${CPP_UTILITIES_INCLUDE_DIRS}")
endif ()
use_cpp_utilities(ONLY_HEADERS VISIBILITY PUBLIC)
# find RapidJSON, also add only the include dirs because RapidJSON is a header-only library
if (RapidJSON_FOUND)