tinyxml2.cmake 852 B

123456789101112131415161718192021222324
  1. if(TARGET tinyxml2::tinyxml2)
  2. return()
  3. endif()
  4. message(STATUS "Third-party: creating target 'tinyxml2::tinyxml2'")
  5. # TODO: Update tinyxml2 version + use FetchContent_MakeAvailable with upstream CMake code
  6. include(FetchContent)
  7. FetchContent_Declare(
  8. tinyxml2
  9. GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
  10. GIT_TAG d175e9de0be0d4db75d0a8cf065599a435a87eb6
  11. )
  12. FetchContent_GetProperties(tinyxml2)
  13. if(NOT tinyxml2_POPULATED)
  14. FetchContent_Populate(tinyxml2)
  15. endif()
  16. add_library(tinyxml2 STATIC ${tinyxml2_SOURCE_DIR}/tinyxml2.cpp ${tinyxml2_SOURCE_DIR}/tinyxml2.h)
  17. add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
  18. target_include_directories(tinyxml2 PUBLIC ${tinyxml2_SOURCE_DIR})
  19. set_target_properties(tinyxml2 PROPERTIES DEFINE_SYMBOL "TINYXML2_EXPORT")
  20. set_target_properties(tinyxml2 PROPERTIES FOLDER ThirdParty)