Skip to content
Snippets Groups Projects
Commit 1cd5db54 authored by Luc Hermitte's avatar Luc Hermitte
Browse files

COMP: OTB-134/OGR now uses the official GDAL_VERSION_NUM #define

parent cf68b6bc
No related branches found
No related tags found
No related merge requests found
# Decompose GDAL version
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" GDAL_VERSION_PATCH "${GDAL_VERSION}")
SET(GDAL_VERSION_MAJOR_STRING "${GDAL_VERSION_MAJOR}" CACHE STRING "Major Version Number of GDAL package found")
SET(GDAL_VERSION_MINOR_STRING "${GDAL_VERSION_MINOR}" CACHE STRING "Minor Version Number of GDAL package found")
SET(GDAL_VERSION_PATCH_STRING "${GDAL_VERSION_PATCH}" CACHE STRING "Patch Version Number of GDAL package found")
MATH(EXPR GDAL_NUM_VERSION "((${GDAL_VERSION_MAJOR})*100+${GDAL_VERSION_MINOR})*100+${GDAL_VERSION_PATCH}")
MESSAGE(STATUS "GDAL Num version: ${GDAL_NUM_VERSION}")
ADD_DEFINITIONS(-DGDAL_VERSION=${GDAL_NUM_VERSION})
# Sources of non-templated classes.
FILE(GLOB OTBOGRAdapters_SRCS "*.cxx" )
......
......@@ -113,7 +113,7 @@ void otb::ogr::Layer::SetFeature(Feature feature)
std::string otb::ogr::Layer::GetName() const
{
assert(m_Layer && "null layer");
#if GDAL_VERSION >= 10800
#if GDAL_VERSION_NUM >= 1800
return m_Layer->GetName();
#else
return GetLayerDefn().GetName();
......@@ -188,7 +188,7 @@ void otb::ogr::Layer::CreateField(
void otb::ogr::Layer::DeleteField(size_t fieldIndex)
{
assert(m_Layer && "OGRLayer not initialized");
#if GDAL_VERSION < 10900
#if GDAL_VERSION_NUM < 1900
itkGenericExceptionMacro("OGRLayer::AlterFieldDefn is not supported by OGR v"
<< GDAL_VERSION << ". Upgrade to a version >= 1.9.0, and recompile OTB.")
#else
......@@ -205,7 +205,7 @@ void otb::ogr::Layer::AlterFieldDefn(
size_t fieldIndex, OGRFieldDefn& newFieldDefn, int nFlags)
{
assert(m_Layer && "OGRLayer not initialized");
#if GDAL_VERSION < 10900
#if GDAL_VERSION_NUM < 1900
itkGenericExceptionMacro("OGRLayer::AlterFieldDefn is not supported by OGR v"
<< GDAL_VERSION << ". Upgrade to a version >= 1.9.0, and recompile OTB.")
#else
......@@ -221,7 +221,7 @@ void otb::ogr::Layer::AlterFieldDefn(
void otb::ogr::Layer::ReorderField(size_t oldPos, size_t newPos)
{
assert(m_Layer && "OGRLayer not initialized");
#if GDAL_VERSION < 10900
#if GDAL_VERSION_NUM < 1900
itkGenericExceptionMacro("OGRLayer::ReorderField is not supported by OGR v"
<< GDAL_VERSION << ". Upgrade to a version >= 1.9.0, and recompile OTB.")
#else
......@@ -237,7 +237,7 @@ void otb::ogr::Layer::ReorderField(size_t oldPos, size_t newPos)
void otb::ogr::Layer::ReorderFields(int * map)
{
assert(m_Layer && "OGRLayer not initialized");
#if GDAL_VERSION < 10900
#if GDAL_VERSION_NUM < 1900
itkGenericExceptionMacro("OGRLayer::ReorderField is not supported by OGR v"
<< GDAL_VERSION << ". Upgrade to a version >= 1.9.0, and recompile OTB.")
#else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment