Skip to content
Snippets Groups Projects
Commit 55a1f81b authored by Christophe Palmann's avatar Christophe Palmann
Browse files

ENH: gdal config, some more improvements

parent 0d80c670
No related branches found
No related tags found
No related merge requests found
......@@ -12,10 +12,13 @@ using namespace std;
int main(int argc, char * argv[])
{
int MAJOR = atoi(argv[2]);
int MINOR = atoi(argv[3]);
string version(GDALVersionInfo("RELEASE_NAME"));
// Remember gdal version
const char * inputFilename = argv[1];
const char * inputFilename = argv[1];
ofstream file(inputFilename, ios::out | ios::trunc);
if(file)
{
......@@ -52,9 +55,9 @@ int main(int argc, char * argv[])
}
if ( (UIntVect[0]<1) || (UIntVect[1]<10) )
if ( (UIntVect[0]<MAJOR) || (UIntVect[1]<MINOR) )
{
cout << "WARNING : Version of GDAL must be >= 1.10 (" << UIntVect[0] << "." << UIntVect[1] << " detected)." << endl;
cout << "WARNING : Version of GDAL must be >= " << MAJOR << "." << MINOR << " : " << UIntVect[0] << "." << UIntVect[1] << " detected)." << endl;
return 1;
}
......
......@@ -11,9 +11,12 @@ endif()
message(STATUS "Check if Gdal qualifies for Orfeo ToolBox")
set(MIN_MAJOR_VERSION 1)
set(MIN_MINOR_VERSION 10)
#------------------- TESTS ---------------------
# Version of GDAL
try_run(RUN_RESULT_VERSION COMPILE_RESULT_VERSION ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalVersionTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/gdalVersion.txt)
try_run(RUN_RESULT_VERSION COMPILE_RESULT_VERSION ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalVersionTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/gdalVersion.txt ${MIN_MAJOR_VERSION} ${MIN_MINOR_VERSION})
# Has OGR
try_compile(GDAL_HAS_OGR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOGRTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}")
......@@ -37,7 +40,8 @@ if (NOT COMPILE_RESULT_VERSION)
endif()
if (${RUN_RESULT_VERSION} EQUAL 1)
message(WARNING "Version of GDAL must be >= 1.10")
file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION)
message(WARNING "Version of GDAL must be >= " ${MIN_MAJOR_VERSION} "." ${MIN_MINOR_VERSION} " : " ${DETECTED_VERSION} " detected.")
endif()
if (NOT GDAL_HAS_OGR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment