Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding libconfig with cmake add_subdirectory #154

Open
dandrestor opened this issue Oct 15, 2019 · 2 comments
Open

Support adding libconfig with cmake add_subdirectory #154

dandrestor opened this issue Oct 15, 2019 · 2 comments

Comments

@dandrestor
Copy link

dandrestor commented Oct 15, 2019

Right now the libconfig project cannot be added as a sub-project in a larger cmake codebase. The problem is that the header files are not automatically found during the build phase. Please support this by adding something along the lines of:

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e0d4730..c05eaf1 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -82,10 +82,12 @@ endif()
 
 target_include_directories(${libname}
   PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
+		 "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
   )
 
 target_include_directories(${libname}++
   PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
+		 "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
   )
 
 install(TARGETS ${libname}
@Challanger524

This comment was marked as resolved.

@Challanger524
Copy link
Contributor

Looks like this is fixed/addressed

target_include_directories(${libname} PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_include_directories(${libname}++ PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants