Skip to content

Commit 6b3cc35

Browse files
dbermondShatur
authored andcommitted
CMake: honor CMAKE_INSTALL_INCLUDEDIR in exported target
Remove the hardcode to the 'include' directory in the CMake exported target. This will let the user correctly access the headers when building a client application with a QHotkey package that is installed with a CMAKE_INSTALL_INCLUDEDIR different than 'include'.
1 parent 25f2184 commit 6b3cc35

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ add_library(qhotkey ${SRC_FILES} ${MOC_HEADERS})
5757
add_library(QHotkey::QHotkey ALIAS qhotkey)
5858
target_link_libraries(qhotkey ${LIBS})
5959

60+
include(GNUInstallDirs)
61+
6062
target_include_directories(qhotkey
6163
PUBLIC
6264
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/QHotkey>
63-
$<INSTALL_INTERFACE:include>)
65+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
6466

6567
set_target_properties(qhotkey PROPERTIES
6668
SOVERSION ${PROJECT_VERSION_MAJOR}
@@ -71,7 +73,6 @@ if(QHOTKEY_EXAMPLES)
7173
endif()
7274

7375
if(QHOTKEY_INSTALL)
74-
include(GNUInstallDirs)
7576
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/QHotkey)
7677

7778
install(
@@ -82,7 +83,7 @@ if(QHOTKEY_INSTALL)
8283
install(FILES
8384
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/qhotkey.h
8485
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/QHotkey
85-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/)
86+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
8687
install(EXPORT QHotkeyConfig DESTINATION ${INSTALL_CONFIGDIR})
8788

8889
export(TARGETS qhotkey FILE QHotkeyConfig.cmake)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy