From 3fde1dccc4d734edac3582ef11141d942d8c78c4 Mon Sep 17 00:00:00 2001 From: Schdro <> Date: Tue, 23 May 2023 23:25:04 +0200 Subject: [PATCH] Export include path (argtable3.h) via CMake module This way the exported header file can be used cleanly by searching the exported config package, more so when nonstandard paths are used for installing header. Also use expression template to differentiate between potentially different paths during time of compilation and module use. Resembles doc "cmake/help/latest/guide/importing-exporting". --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e0b519..5fb1404 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,7 +77,10 @@ else() endif() add_library(${ARGTABLE3_PROJECT_NAME}::argtable3 ALIAS argtable3) -target_include_directories(argtable3 PRIVATE ${PROJECT_SOURCE_DIR}/src) +target_include_directories(argtable3 PUBLIC + "$" + "$" +) set_target_properties(argtable3 PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} @@ -98,6 +101,7 @@ install(TARGETS argtable3 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(FILES "${PROJECT_SOURCE_DIR}/src/argtable3.h"