Commit 6ddf92d0 authored by Julien Malik's avatar Julien Malik

COMP: find out if tinyxml is compiled with STL support, and adapt to it

parent b2149f71
......@@ -14,13 +14,34 @@ ENDIF( TINYXML_INCLUDE_DIR )
FIND_PATH( TINYXML_INCLUDE_DIR tinyxml.h
PATH_SUFFIXES tinyxml )
FIND_LIBRARY( TINYXML_LIBRARIES
FIND_LIBRARY( TINYXML_LIBRARY
NAMES tinyxml
PATH_SUFFIXES tinyxml )
# handle the QUIETLY and REQUIRED arguments and set TINYXML_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( TinyXML DEFAULT_MSG TINYXML_INCLUDE_DIR TINYXML_LIBRARIES )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( TinyXML DEFAULT_MSG TINYXML_INCLUDE_DIR TINYXML_LIBRARY )
MARK_AS_ADVANCED( TINYXML_INCLUDE_DIR TINYXML_LIBRARIES )
MARK_AS_ADVANCED( TINYXML_INCLUDE_DIR TINYXML_LIBRARY )
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(TINYXML_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(TINYXML_USE_STL)
ENDIF(TINYXML_FOUND)
......@@ -68,6 +68,11 @@
/* SiftFast */
#cmakedefine OTB_USE_SIFTFAST
/* TinyXML Has STL */
#ifndef TINYXML_USE_STL
#cmakedefine TINYXML_USE_STL
#endif TINYXML_USE_STL
/* Use Visu/Gui configurations */
#cmakedefine OTB_USE_VISU_GUI
......
......@@ -34,6 +34,7 @@ SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
${OTB_SOURCE_DIR}/Code/Testing
${OTB_SOURCE_DIR}/Code/UtilitiesAdapters/CurlAdapters
${OTB_SOURCE_DIR}/Code/UtilitiesAdapters/OssimAdapters
${OTB_SOURCE_DIR}/Code/UtilitiesAdapters/TinyXMLAdapters
${OTB_SOURCE_DIR}/Code/Visu
${OTB_SOURCE_DIR}/Code/Visualization
${OTB_BINARY_DIR}/Code/Visualization
......@@ -83,7 +84,7 @@ ENDIF(OTB_USE_SIFTFAST)
IF(OTB_USE_EXTERNAL_TINYXML)
SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
${TINYXML_INCLUDE_DIR})
${TINYXML_INCLUDE_DIRS})
ELSE(OTB_USE_EXTERNAL_TINYXML)
SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
${OTB_SOURCE_DIR}/Utilities/tinyXMLlib)
......@@ -264,6 +265,7 @@ SET(OTB_INCLUDE_RELATIVE_DIRS ${OTB_INCLUDE_RELATIVE_DIRS}
Testing
UtilitiesAdapters/CurlAdapters
UtilitiesAdapters/OssimAdapters
UtilitiesAdapters/TinyXMLAdapters
OBIA
Fuzzy
ObjectDetection
......@@ -338,7 +340,7 @@ ENDIF(OTB_USE_EXTERNAL_FLTK)
#For TinyXML header file
IF(OTB_USE_EXTERNAL_TINYXML)
SET(OTB_INCLUDE_ABSOLUE_DIRS ${OTB_INCLUDE_ABSOLUE_DIRS}
${TINYXML_INCLUDE_DIR})
${TINYXML_INCLUDE_DIRS})
ELSE(OTB_USE_EXTERNAL_TINYXML)
SET(OTB_INCLUDE_RELATIVE_DIRS ${OTB_INCLUDE_RELATIVE_DIRS}
Utilities/tinyXMLlib)
......
#include <tinyxml.h>
int main(int argc, char* argv[])
{
TiXmlDocument doc( NULL );
std::cout << doc;
TiXmlString s;
}
......@@ -19,7 +19,7 @@
#include "otbFuzzyDescriptorsModelManager.h"
#include "itkMacro.h"
#include "itksys/SystemTools.hxx"
#include "tinyxml.h"
#include "otbTinyXML.h"
namespace otb {
......
......@@ -23,7 +23,7 @@
#include "otbMacro.h"
#include "otbUtils.h"
#include "tinyxml.h"
#include "otbTinyXML.h"
#include "otbCurlHelper.h"
#include "itkMersenneTwisterRandomVariateGenerator.h"
......
......@@ -44,7 +44,7 @@ extern "C"
#include "itksys/SystemTools.hxx"
#include "tinyxml.h"
#include "otbTinyXML.h"
/**
......
......@@ -22,7 +22,7 @@
#include "itkDataObject.h"
#include "itkMacro.h"
#include "tinyxml.h"
#include "otbTinyXML.h"
namespace otb
{
......
......@@ -17,7 +17,7 @@
=========================================================================*/
#include "otbPlaceNameToLonLat.h"
#include "tinyxml.h"
#include "otbTinyXML.h"
#include "otbCurlHelper.h"
namespace otb
......
......@@ -21,7 +21,7 @@
#include "otbStatisticsXMLFileReader.h"
#include "itkMacro.h"
#include "itksys/SystemTools.hxx"
#include "tinyxml.h"
#include "otbTinyXML.h"
namespace otb {
......
......@@ -21,7 +21,7 @@
#include "otbStatisticsXMLFileWriter.h"
#include "itkMacro.h"
#include "itksys/SystemTools.hxx"
#include "tinyxml.h"
#include "otbTinyXML.h"
namespace otb {
......
ADD_SUBDIRECTORY(CurlAdapters)
ADD_SUBDIRECTORY(OssimAdapters)
ADD_SUBDIRECTORY(TinyXMLAdapters)
IF(NOT OTB_INSTALL_NO_DEVELOPMENT)
INSTALL(FILES otbTinyXML.h
DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/UtilitiesAdapters/TinyXMLAdapters
COMPONENT Development)
ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT)
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbTinyXML_h
#define __otbTinyXML_h
/**
* TinyXML header uses the TINYXML_USE_STL macro
* This must be defined before including the tinyxml header.
*
* Using the upstream headers, it depends on how tinyxml is compiled,
* which is detected by a try_compile test
* Note that Debian patches the tinyxml.h to unconditionnally define TINYXML_USE_STL
*/
#include "otbConfigure.h"
#include "tinyxml.h"
#endif
......@@ -4,7 +4,7 @@
#include "itkMacro.h"
#include "tinyxml.h"
#include "otbTinyXML.h"
#ifdef TIXML_USE_STL
#include <iostream>
......
......@@ -20,5 +20,5 @@ IF(NOT OTB_INSTALL_NO_DEVELOPMENT)
COMPONENT Development)
ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT)
SET(TINYXML_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(TINYXML_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
SET(TINYXML_LIBRARIES otbtinyXML)
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