4 # Finds the TinyXML library
6 # The following imported targets are created::
8 # ${APP_NAME_LC}::TinyXML - The TinyXML library
10 if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
11 find_package(PkgConfig)
14 pkg_check_modules(PC_TINYXML tinyxml QUIET)
17 find_path(TINYXML_INCLUDE_DIR tinyxml.h
19 HINTS ${PC_TINYXML_INCLUDEDIR})
20 find_library(TINYXML_LIBRARY_RELEASE NAMES tinyxml tinyxmlSTL
22 HINTS ${PC_TINYXML_LIBDIR})
23 find_library(TINYXML_LIBRARY_DEBUG NAMES tinyxmld tinyxmlSTLd
25 HINTS ${PC_TINYXML_LIBDIR})
26 set(TINYXML_VERSION ${PC_TINYXML_VERSION})
28 include(SelectLibraryConfigurations)
29 select_library_configurations(TINYXML)
31 include(FindPackageHandleStandardArgs)
32 find_package_handle_standard_args(TinyXML
33 REQUIRED_VARS TINYXML_LIBRARY TINYXML_INCLUDE_DIR
34 VERSION_VAR TINYXML_VERSION)
37 add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
38 if(TINYXML_LIBRARY_RELEASE)
39 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
40 IMPORTED_CONFIGURATIONS RELEASE
41 IMPORTED_LOCATION_RELEASE "${TINYXML_LIBRARY_RELEASE}")
43 if(TINYXML_LIBRARY_DEBUG)
44 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
45 IMPORTED_LOCATION_DEBUG "${TINYXML_LIBRARY_DEBUG}")
46 set_property(TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} APPEND PROPERTY
47 IMPORTED_CONFIGURATIONS DEBUG)
49 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
50 INTERFACE_INCLUDE_DIRECTORIES "${TINYXML_INCLUDE_DIR}")
51 if(WIN32 OR WINDOWS_STORE)
52 set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
53 INTERFACE_COMPILE_DEFINITIONS TIXML_USE_STL)
56 if(TinyXML_FIND_REQUIRED)
57 message(FATAL_ERROR "TinyXML library not found.")