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.
That's excatly what I need in my project. Thumb up!
Yep, that would be a really convenient feature.
Great feature proposal! I`m also looking forward to use it in my project.
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()
Merged. Thanks @kurylo
Most helpful comment
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: