diff --git a/CMakeLists.txt b/CMakeLists.txt index d95f2b1d..a0ea1240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,13 +96,18 @@ find_package(SimGear 3.1.0 REQUIRED) find_package(GDAL 1.6.0 REQUIRED) find_package(TIFF REQUIRED) # needed for SRTM +set (CGAL_MINIMUM 4.0) +set (CGAL_OLD 0) find_package(CGAL COMPONENTS Core REQUIRED) if (CGAL_FOUND) - if(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.0) - message(FATAL_ERROR "CGAL >= 4.0 is required. Found ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}") - else(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.0) + if(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS ${CGAL_MINIMUM}) + message(FATAL_ERROR "CGAL >= ${CGAL_MINIMUM} is required. Found CGAL ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}") + else(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS ${CGAL_MINIMUM}) message(STATUS "Found CGAL ${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}") - endif(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.0) + if(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS 4.5) + set (CGAL_OLD 1) + endif() + endif(${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION} VERSION_LESS ${CGAL_MINIMUM}) endif (CGAL_FOUND) include ( ${CGAL_USE_FILE} ) diff --git a/src/Include/config_cmake.h.in b/src/Include/config_cmake.h.in index c403da7d..a87bc00d 100644 --- a/src/Include/config_cmake.h.in +++ b/src/Include/config_cmake.h.in @@ -2,5 +2,4 @@ #cmakedefine HAVE_WINDOWS_H #cmakedefine HAVE_RINT #cmakedefine HAVE_UNISTD_H - - +#cmakedefine CGAL_OLD diff --git a/src/Lib/terragear/tg_nodes.cxx b/src/Lib/terragear/tg_nodes.cxx index 7a5a384e..1280889f 100644 --- a/src/Lib/terragear/tg_nodes.cxx +++ b/src/Lib/terragear/tg_nodes.cxx @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include "tg_nodes.hxx" @@ -81,7 +85,7 @@ bool TGNodes::get_geod_edge( const SGBucket& b, std::vector& north, std: // Three dimensional queries is a bit overkill, but the code, although faster, is slightly more cumbersome // get function for the property map - needed for cgal trait extension -#if 0 +#ifdef CGAL_OLD My_point_property_map::reference get(My_point_property_map, My_point_property_map::key_type p) { return boost::get<0>(p); } @@ -256,4 +260,4 @@ void TGNodes::SaveToGzFile( gzFile& fp ) void TGNodes::LoadFromGzFile( gzFile& fp ) { tg_node_list.LoadFromGzFile( fp ); -} \ No newline at end of file +} diff --git a/src/Lib/terragear/tg_nodes.hxx b/src/Lib/terragear/tg_nodes.hxx index 0eb7e978..a841b499 100644 --- a/src/Lib/terragear/tg_nodes.hxx +++ b/src/Lib/terragear/tg_nodes.hxx @@ -1,8 +1,8 @@ #ifndef _TG_NODES_HXX #define _TG_NODES_HXX -#ifndef __cplusplus -# error This library requires C++ +#ifdef HAVE_CONFIG_H +# include #endif #include @@ -20,7 +20,7 @@ typedef Kernel::Point_2 Point; typedef boost::tuple Point_and_Elevation; //definition of the property map -#if 0 +#ifdef CGAL_OLD struct My_point_property_map{ typedef Point value_type; typedef const value_type& reference; @@ -31,8 +31,12 @@ struct My_point_property_map{ //typedef CGAL::Search_traits_2 Traits; typedef CGAL::Search_traits_2 Traits_base; -//typedef CGAL::Search_traits_adapter Traits; + +#ifdef CGAL_OLD +typedef CGAL::Search_traits_adapter Traits; +#else typedef CGAL::Search_traits_adapter,Traits_base> Traits; +#endif typedef CGAL::Fuzzy_iso_box Fuzzy_bb; typedef CGAL::Kd_tree Tree; diff --git a/src/Prep/GDALChop/gdalchop.cxx b/src/Prep/GDALChop/gdalchop.cxx index cdfaba29..78bb7e3a 100644 --- a/src/Prep/GDALChop/gdalchop.cxx +++ b/src/Prep/GDALChop/gdalchop.cxx @@ -22,10 +22,6 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. // -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include