mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-15 16:18:00 +08:00
[tinyxml] Use proper CMake targets (#11383)
* use proper cmake targets * change target name to be unofficial
This commit is contained in:
parent
4c1db6840f
commit
2c2735a9e1
@ -10,20 +10,31 @@ set(SOURCES "tinyxml.cpp"
|
|||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
||||||
|
|
||||||
add_library(tinyxml ${SOURCES})
|
add_library(unofficial-tinyxml ${SOURCES})
|
||||||
target_compile_definitions(tinyxml PRIVATE "-DTIXML_USE_STL")
|
target_compile_definitions(unofficial-tinyxml PRIVATE "-DTIXML_USE_STL")
|
||||||
|
set_target_properties(unofficial-tinyxml PROPERTIES OUTPUT_NAME tinyxml)
|
||||||
|
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
generate_export_header(tinyxml)
|
generate_export_header(unofficial-tinyxml BASE_NAME tinyxml)
|
||||||
|
|
||||||
target_include_directories(tinyxml PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(unofficial-tinyxml
|
||||||
|
PUBLIC
|
||||||
install(
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||||
TARGETS tinyxml
|
$<INSTALL_INTERFACE:include>
|
||||||
|
)
|
||||||
|
install(TARGETS unofficial-tinyxml
|
||||||
|
EXPORT tinyxml-export
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
)
|
)
|
||||||
|
install(EXPORT tinyxml-export
|
||||||
|
FILE
|
||||||
|
tinyxmlTargets.cmake
|
||||||
|
NAMESPACE
|
||||||
|
unofficial-tinyxml::
|
||||||
|
DESTINATION
|
||||||
|
share/tinyxml
|
||||||
|
)
|
||||||
install(FILES ${HEADERS}
|
install(FILES ${HEADERS}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tinyxml_export.h DESTINATION include)
|
${CMAKE_CURRENT_BINARY_DIR}/tinyxml_export.h DESTINATION include)
|
||||||
|
@ -26,8 +26,9 @@ vcpkg_configure_cmake(
|
|||||||
|
|
||||||
vcpkg_install_cmake()
|
vcpkg_install_cmake()
|
||||||
vcpkg_copy_pdbs()
|
vcpkg_copy_pdbs()
|
||||||
|
vcpkg_fixup_cmake_targets()
|
||||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
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}/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)
|
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/tinyxml-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/tinyxml)
|
||||||
|
@ -3,17 +3,6 @@ if (tinyxml_CONFIG_INCLUDED)
|
|||||||
endif()
|
endif()
|
||||||
set(tinyxml_CONFIG_INCLUDED TRUE)
|
set(tinyxml_CONFIG_INCLUDED TRUE)
|
||||||
|
|
||||||
set(tinyxml_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
|
include(${CMAKE_CURRENT_LIST_DIR}/tinyxmlTargets.cmake)
|
||||||
|
set(tinyxml_LIBRARIES unofficial-tinyxml::unofficial-tinyxml)
|
||||||
foreach(lib tinyxml)
|
get_target_property(tinyxml_INCLUDE_DIRS unofficial-tinyxml::unofficial-tinyxml INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
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()
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user