Skip to content

Commit 917c925

Browse files
authored
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"
1 parent a32d7e2 commit 917c925

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libdbcppp/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ include_directories(
1414
${CMAKE_BINARY_DIR}/src
1515
)
1616

17+
target_include_directories(
18+
${PROJECT_NAME}
19+
PUBLIC
20+
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/>
21+
)
22+
1723
test_big_endian(is_big_endian)
1824
if (is_big_endian)
1925
set(BYTE_ORDER Big)
@@ -67,7 +73,7 @@ configure_file(cmake/${PROJECT_NAME}Config.cmake
6773
@ONLY
6874
)
6975

70-
set(ConfigPackageLocation lib/cmake/${PROJECT_NAME})
76+
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
7177
install(EXPORT ${PROJECT_NAME}Targets
7278
FILE
7379
${PROJECT_NAME}Targets.cmake

0 commit comments

Comments
 (0)