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

CMakeLists.txt does not export include paths. #444

Closed
ghost opened this issue Jun 21, 2016 · 5 comments
Closed

CMakeLists.txt does not export include paths. #444

ghost opened this issue Jun 21, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Jun 21, 2016

Please add something similar to:
target_include_directories(tinyxml2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.)

target_include_directories(tinyxml2_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/.)

to CMakeLists.txt. This will allow building and linking with tinyxml2 in a single build tree. Application using cmake would be able to just: add_subdirectory(tinyxml2) and then use tinyxml2 targets.

@TomaszNo
Copy link

That's excatly what I need in my project. Thumb up!

@KDuzinkiewicz
Copy link

Yep, that would be a really convenient feature.

@burmix
Copy link

burmix commented Jun 22, 2016

Great feature proposal! I`m also looking forward to use it in my project.

@ghost
Copy link
Author

ghost commented Jun 22, 2016

Using target_include_directories requires cmake version at least 2.8.11. If you want to keep compatibility with the cmake 2.6, good approach to handle this can be seen in CMakeLists of googletest:

# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
  target_include_directories(gtest      INTERFACE "${gtest_SOURCE_DIR}/include")
  target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include")
endif()

@leethomason
Copy link
Owner

Merged. Thanks @kurylo

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

No branches or pull requests

4 participants