From 5c49a438ade5ae4253ae978e3a22cf88bd7cb2e2 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 1 Jan 2021 18:48:14 +0100 Subject: [PATCH] Use header-only target of c++utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 $ can not help with that. --- CMakeLists.txt | 2 +- lib/CMakeLists.txt | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abc7d55..7596e0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index c4ec92f..f555b2a 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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 $ - $) -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)