Skip to content

Commit

Permalink
Adds a few cmake fixes to improve package discovery. (#97)
Browse files Browse the repository at this point in the history
- Adds target_include_directories to properly discover header files when using an external target.
- Replaces "lib" by "CMAKE_INSTALL_LIBDIR" when setting "ConfigPackageLocation"
  • Loading branch information
agalbachicar authored May 30, 2022
1 parent a32d7e2 commit 917c925
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libdbcppp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ include_directories(
${CMAKE_BINARY_DIR}/src
)

target_include_directories(
${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/>
)

test_big_endian(is_big_endian)
if (is_big_endian)
set(BYTE_ORDER Big)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 917c925

Please sign in to comment.