If change the include path destination when run cmake configure with `DCMAKE_INSTALL_INCLUDEDIR`, the .cmake generated still point to hardcoded path `include`. this fix it (#178)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4be11ea..ed62417 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,13 +6,15 @@
# https://stackoverflow.com/questions/43379311/why-does-project-affect-cmakes-opinion-on-cmake-sizeof-void-p
)
+include(GNUInstallDirs)
+
add_library(Headers INTERFACE)
target_include_directories(Headers
SYSTEM
BEFORE
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
- $<INSTALL_INTERFACE:include>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
install(
@@ -20,8 +22,6 @@
EXPORT OpenCLHeadersTargets
)
-include(GNUInstallDirs)
-
install(
DIRECTORY CL
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}