From 917c925638f3089cd099915b1ab779929033c09b Mon Sep 17 00:00:00 2001 From: Agustin Alba Chicar Date: Mon, 30 May 2022 10:13:01 +0200 Subject: [PATCH] Adds a few cmake fixes to improve package discovery. (#97) - Adds target_include_directories to properly discover header files when using an external target. - Replaces "lib" by "CMAKE_INSTALL_LIBDIR" when setting "ConfigPackageLocation" --- src/libdbcppp/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libdbcppp/CMakeLists.txt b/src/libdbcppp/CMakeLists.txt index 1365bf03..9a69748e 100644 --- a/src/libdbcppp/CMakeLists.txt +++ b/src/libdbcppp/CMakeLists.txt @@ -14,6 +14,12 @@ include_directories( ${CMAKE_BINARY_DIR}/src ) +target_include_directories( + ${PROJECT_NAME} + PUBLIC + $/${CMAKE_INSTALL_INCLUDEDIR}/> +) + test_big_endian(is_big_endian) if (is_big_endian) set(BYTE_ORDER Big) @@ -67,7 +73,7 @@ configure_file(cmake/${PROJECT_NAME}Config.cmake @ONLY ) -set(ConfigPackageLocation lib/cmake/${PROJECT_NAME}) +set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) install(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Targets.cmake