Skip to content

Commit

Permalink
assume CMake is giving us GDAL_VERSION all the time
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jul 30, 2019
1 parent c153168 commit 46ecc4d
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cmake/gdal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ find_package(GDAL 2.2.0)
set_package_properties(GDAL PROPERTIES TYPE REQUIRED
PURPOSE "Provides general purpose raster, vector, and reference system support")
if (GDAL_FOUND)

if (NOT ${GDAL_VERSION})
execute_process(COMMAND ${GDAL_CONFIG} "--version" OUTPUT_VARIABLE GDAL_VERSION)
endif()
string(COMPARE GREATER ${GDAL_VERSION} "3.0.0" GDAL_3)
mark_as_advanced(CLEAR GDAL_INCLUDE_DIR)
mark_as_advanced(CLEAR GDAL_LIBRARY)
Expand Down

7 comments on commit 46ecc4d

@vpicavet
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With current master I get the following error, while a version from some weeks ago was fine :

-- Found GDAL: /usr/lib/libgdal.so (Required is at least version "2.2.0") 
CMake Error at cmake/gdal.cmake:8 (string):
  string sub-command COMPARE, mode GREATER needs at least 5 arguments total                                                                                                                                
  to command.                                                                                                                                                                                              
Call Stack (most recent call first):                                                                                                                                                                       
  CMakeLists.txt:117 (include)   

installed GDAL is version 2.2, Ubuntu Bionic package. This commit may be the culprit ?

@hobu
Copy link
Member Author

@hobu hobu commented on 46ecc4d Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is the problem, but we need a better solution.

  • New CMake cures it
  • Making our own call to gdal-config cures it, but we need to do work in situations where gdal-config does not exist (windows, conda) and parse out the version ourselves (older cmake doesn't parse versions correctly).

@abellgithub
Copy link
Contributor

@abellgithub abellgithub commented on 46ecc4d Aug 7, 2019 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hobu
Copy link
Member Author

@hobu hobu commented on 46ecc4d Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can find the header files, we can probably do something to parse gdal_version.h on our own

Our old FindGDAL.cmake used to do (a great job of) this.

@abellgithub
Copy link
Contributor

@abellgithub abellgithub commented on 46ecc4d Aug 7, 2019 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hobu
Copy link
Member Author

@hobu hobu commented on 46ecc4d Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix attempt pushed in aec16d3. Please test @vpicavet

@vpicavet
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and approved : compiles fine on my setup. Thanks !

Please sign in to comment.