From b3d0cfccafad32541c4fd0486b91521b5ba3375f Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Tue, 23 Nov 2021 10:13:22 +0100 Subject: [PATCH] set cmake interface dir on the target this carries through into the Targets.cmake file we install which in turn means that the imported target for the consumer defines its include directory. this removes the need to manually add the include dir also updated the readme accordingly --- README.md | 3 +-- src/CMakeLists.txt | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b36d86f..1d515cd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - @@ -35,7 +35,6 @@ looks like this: ```cmake find_package( KPMcore 3.2 REQUIRED ) - include_directories( ${KPMCORE_INCLUDE_DIR} ) target_link_libraries( target kpmcore ) ``` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 05e3f49..eb343f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2008,2012 Volker Lanz # SPDX-FileCopyrightText: 2015 Teo Mrnjavac # SPDX-FileCopyrightText: 2014-2020 Andrius Štikonas +# SPDX-FileCopyrightText: 2021 Harald Sitter # SPDX-License-Identifier: GPL-3.0-or-later @@ -47,6 +48,8 @@ generate_export_header(kpmcore ) list(APPEND UTIL_LIB_HDRS ${CMAKE_CURRENT_BINARY_DIR}/util/libpartitionmanagerexport.h) +target_include_directories(kpmcore INTERFACE "$") + install(TARGETS kpmcore EXPORT KPMcoreTargets ${INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${CORE_LIB_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/kpmcore/core/ COMPONENT Devel) install(FILES ${BACKEND_LIB_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/kpmcore/backend/ COMPONENT Devel)