1 ##################################################################################################
3 # CMake script for finding TinyXML.
7 # - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
8 # ${TinyXML_ROOT_DIR}/include
9 # ${TinyXML_ROOT_DIR}/libs
10 # respectively, and the default CMake search order will be ignored. When unspecified, the default
11 # CMake search order is used.
12 # This variable can be specified either as a CMake or environment variable. If both are set,
13 # preference is given to the CMake variable.
14 # Use this variable for finding packages installed in a nonstandard location, or for enforcing
15 # that one of multiple package installations is picked up.
18 # Cache variables (not intended to be used in CMakeLists.txt files)
20 # - TinyXML_INCLUDE_DIR: Absolute path to package headers.
21 # - TinyXML_LIBRARY: Absolute path to library.
26 # - TinyXML_FOUND: Boolean that indicates if the package was found
27 # - TinyXML_INCLUDE_DIRS: Paths to the necessary header files
28 # - TinyXML_LIBRARIES: Package libraries
33 # find_package(TinyXML)
34 # if(NOT TinyXML_FOUND)
38 # include_directories(${TinyXML_INCLUDE_DIRS} ...)
40 # target_link_libraries(my_target ${TinyXML_LIBRARIES})
42 ##################################################################################################
43 #from: https://github.com/ros/cmake_modules/blob/0.3-devel/cmake/Modules/FindTinyXML.cmake
45 # Get package location hint from environment variable (if any)
46 if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR})
47 set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH
48 "TinyXML base directory location (optional, used for nonstandard installation paths)")
51 # Search path for nonstandard package locations
53 set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH)
54 set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH)
57 # Find headers and libraries
58 find_path(TinyXML_INCLUDE_DIR NAMES tinyxml.h PATH_SUFFIXES "tinyxml" ${TinyXML_INCLUDE_PATH})
59 find_library(TinyXML_LIBRARY NAMES tinyxml PATH_SUFFIXES "tinyxml" ${TinyXML_LIBRARY_PATH})
61 mark_as_advanced(TinyXML_INCLUDE_DIR
64 # Output variables generation
65 include(FindPackageHandleStandardArgs)
66 find_package_handle_standard_args(TinyXML DEFAULT_MSG TinyXML_LIBRARY
69 set(TinyXML_FOUND ${TINYXML_FOUND}) # Enforce case-correctness: Set appropriately cased variable...
70 unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args
73 set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR})
74 set(TinyXML_LIBRARIES ${TinyXML_LIBRARY})