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
This commit is contained in:
Harald Sitter 2021-11-23 10:13:22 +01:00
parent d9339e4833
commit b3d0cfccaf
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<!-- SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
<!-- SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
SPDX-FileCopyrightText: 2017-2020 Andrius Štikonas <andrius@stikonas.eu>
SPDX-License-Identifier: CC-BY-4.0
-->
@ -35,7 +35,6 @@ looks like this:
```cmake
find_package( KPMcore 3.2 REQUIRED )
include_directories( ${KPMCORE_INCLUDE_DIR} )
target_link_libraries( target kpmcore )
```

View File

@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2008,2012 Volker Lanz <vl@fidra.de>
# SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
# SPDX-FileCopyrightText: 2014-2020 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
# 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_INTERFACE:${INCLUDE_INSTALL_DIR}/kpmcore>")
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)