diff --git a/ports/tinyxml/CMakeLists.txt b/ports/tinyxml/CMakeLists.txt index b849c07f9c..2004da4af7 100644 --- a/ports/tinyxml/CMakeLists.txt +++ b/ports/tinyxml/CMakeLists.txt @@ -10,20 +10,31 @@ set(SOURCES "tinyxml.cpp" option(BUILD_SHARED_LIBS "Build shared libs" OFF) -add_library(tinyxml ${SOURCES}) -target_compile_definitions(tinyxml PRIVATE "-DTIXML_USE_STL") +add_library(unofficial-tinyxml ${SOURCES}) +target_compile_definitions(unofficial-tinyxml PRIVATE "-DTIXML_USE_STL") +set_target_properties(unofficial-tinyxml PROPERTIES OUTPUT_NAME tinyxml) include(GenerateExportHeader) -generate_export_header(tinyxml) +generate_export_header(unofficial-tinyxml BASE_NAME tinyxml) -target_include_directories(tinyxml PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) - -install( - TARGETS tinyxml +target_include_directories(unofficial-tinyxml + PUBLIC + $ + $ +) +install(TARGETS unofficial-tinyxml + EXPORT tinyxml-export ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) - +install(EXPORT tinyxml-export +FILE + tinyxmlTargets.cmake +NAMESPACE + unofficial-tinyxml:: +DESTINATION + share/tinyxml +) install(FILES ${HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/tinyxml_export.h DESTINATION include) diff --git a/ports/tinyxml/portfile.cmake b/ports/tinyxml/portfile.cmake index b43526efa4..0ffc859aa3 100644 --- a/ports/tinyxml/portfile.cmake +++ b/ports/tinyxml/portfile.cmake @@ -26,8 +26,9 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() - +vcpkg_fixup_cmake_targets() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinyxml RENAME copyright) file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/tinyxml-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinyxml) diff --git a/ports/tinyxml/tinyxml-config.cmake b/ports/tinyxml/tinyxml-config.cmake index 1bdc5ad7f3..15ad7bdc5d 100644 --- a/ports/tinyxml/tinyxml-config.cmake +++ b/ports/tinyxml/tinyxml-config.cmake @@ -3,17 +3,6 @@ if (tinyxml_CONFIG_INCLUDED) endif() set(tinyxml_CONFIG_INCLUDED TRUE) -set(tinyxml_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include") - -foreach(lib tinyxml) - set(onelib "${lib}-NOTFOUND") - find_library(onelib ${lib} - PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" - NO_DEFAULT_PATH - ) - if(NOT onelib) - message(FATAL_ERROR "Library '${lib}' in package tinyxml is not installed properly") - endif() - list(APPEND tinyxml_LIBRARIES ${onelib}) -endforeach() - +include(${CMAKE_CURRENT_LIST_DIR}/tinyxmlTargets.cmake) +set(tinyxml_LIBRARIES unofficial-tinyxml::unofficial-tinyxml) +get_target_property(tinyxml_INCLUDE_DIRS unofficial-tinyxml::unofficial-tinyxml INTERFACE_INCLUDE_DIRECTORIES) \ No newline at end of file