1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Better FindTinyXML2.cmake. Fixes #44.

This commit is contained in:
fgenesis 2017-01-13 13:06:31 +01:00
parent bb7cb7df71
commit 8e576b66e7

View file

@ -1,20 +1,42 @@
# - Try to find TinyXML2 # Copyright (c) 2015-2016, Graphics Lab, Georgia Tech Research Corporation
# Once done this will define # Copyright (c) 2015-2016, Humanoid Lab, Georgia Tech Research Corporation
# TINYXML2_FOUND - System has TinyXML2 # Copyright (c) 2016, Personal Robotics Lab, Carnegie Mellon University
# TINYXML2_INCLUDE_DIRS - The TinyXML2 include directories # This file is provided under the "BSD-style" License
# TINYXML2_LIBRARIES - The libraries needed to use TinyXML2
# TINYXML2_DEFINITIONS - Compiler switches required for using TinyXML2
find_package(PkgConfig) # Find TINYXML2
pkg_check_modules(PC_TINYXML2 QUIET tinyxml2) #
set(TINYXML2_INCLUDE_DIRS ${PC_TINYXML2_INCLUDE_DIRS}) # This sets the following variables:
set(TINYXML2_DEFINITIONS ${PC_TINYXML2_CFLAGS_OTHER}) # TINYXML2_FOUND
# TINYXML2_INCLUDE_DIRS
# TINYXML2_LIBRARIES
# TINYXML2_VERSION
find_library(TINYXML2_LIBRARY NAMES tinyxml2 find_package(PkgConfig QUIET)
HINTS ${PC_TINYXML2_LIBDIR} ${PC_TINYXML2_LIBRARY_DIRS})
set(TINYXML2_LIBRARIES ${TINYXML2_LIBRARY})
# Check if the pkgconfig file is installed
pkg_check_modules(PC_TINYXML2 tinyxml2 QUIET)
# Include directories
find_path(TINYXML2_INCLUDE_DIRS
NAMES tinyxml2.h
HINTS ${PC_TINYXML2_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include")
# Libraries
if(MSVC)
set(TINYXML2_LIBRARIES optimized tinyxml2 debug tinyxml2d)
else()
find_library(TINYXML2_LIBRARIES
NAMES tinyxml2
HINTS ${PC_TINYXML2_LIBDIR})
endif()
# Version
set(TINYXML2_VERSION ${PC_TINYXML2_VERSION})
# Set (NAME)_FOUND if all the variables and the version are satisfied.
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TINYXML2_LIBRARY TINYXML2_INCLUDE_DIRS) find_package_handle_standard_args(TINYXML2
FAIL_MESSAGE DEFAULT_MSG
mark_as_advanced(TINYXML2_INCLUDE_DIRS TINYXML2_LIBRARY) REQUIRED_VARS TINYXML2_INCLUDE_DIRS TINYXML2_LIBRARIES
VERSION_VAR TINYXML2_VERSION)