mirror of
https://github.com/cemu-project/vcpkg.git
synced 2024-11-23 19:29:49 +00: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)
|
||||
|
||||
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
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
Loading…
Reference in New Issue
Block a user