Commit 1646c406 authored by Julien Malik's avatar Julien Malik

COMP: move OTB specific try_compile out of FindTinyXML (must be reusable from outside)

parent 5732826e
......@@ -4,8 +4,6 @@
# TINYXML_FOUND - True if TinyXML found.
# TINYXML_INCLUDE_DIRS - where to find tinyxml.h, etc.
# TINYXML_LIBRARIES - List of libraries when using TinyXML.
# TIXML_USE_STL - ON or undefined whether STL support is found
# can be used directly in a #cmakedefine
#
IF( TINYXML_INCLUDE_DIR )
......@@ -32,18 +30,9 @@ IF(TINYXML_FOUND)
SET(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR})
SET(TINYXML_LIBRARIES ${TINYXML_LIBRARY})
# Check if STL support is enabled with macro TIXML_USE_STL
TRY_COMPILE(TIXML_USE_STL
${CMAKE_CURRENT_BINARY_DIR}/CMake
${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestTinyXMLUseSTL.cxx
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TINYXML_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${TINYXML_LIBRARIES}"
COMPILE_DEFINITIONS "-DTIXML_USE_STL"
OUTPUT_VARIABLE OUTPUT)
ELSE(TINYXML_FOUND)
SET(TINYXML_INCLUDE_DIRS)
SET(TINYXML_LIBRARIES)
SET(TIXML_USE_STL)
ENDIF(TINYXML_FOUND)
......@@ -3,9 +3,19 @@ FIND_PACKAGE(TinyXML)
IF(TINYXML_FOUND)
OPTION(OTB_USE_EXTERNAL_TINYXML "Use external TinyXML library." ON)
# Check if STL support is enabled with macro TIXML_USE_STL
TRY_COMPILE(TIXML_USE_STL
${CMAKE_CURRENT_BINARY_DIR}/CMake
${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestTinyXMLUseSTL.cxx
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TINYXML_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${TINYXML_LIBRARIES}"
COMPILE_DEFINITIONS "-DTIXML_USE_STL"
OUTPUT_VARIABLE OUTPUT)
ELSE(TINYXML_FOUND)
OPTION(OTB_USE_EXTERNAL_TINYXML "Use external TinyXML library." OFF)
SET(TINYXML_LIBRARIES otbtinyXML)
SET(TIXML_USE_STL)
ENDIF(TINYXML_FOUND)
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_TINYXML)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment