[gdal-dev] Why can't find_package(GDAL CONFIG) find GDAL_LIBRARIES?

Tom O'Reilly oreilly at mbari.org
Mon Jun 6 17:02:49 PDT 2022


I've just built and installed GDAL 3.5.0 on ubuntu 20.04, with cmake 3.5.0 and make. It appears that 'make install' installs needed cmake config files for GDAL: 



-- Installing: /usr/local/lib/x86_64-linux-gnu/cmake/gdal/GDALConfigVersion.cmake 
-- Installing: /usr/local/lib/x86_64-linux-gnu/cmake/gdal/GDALConfig.cmake 



I'm building my own project that uses GDAL. The CMakelists.txt invokes find_package() and prints out resulting variables: 

BQ_BEGIN

find_package(GDAL CONFIG REQUIRED) 

if (GDAL_FOUND) 
message("GDAL Found!") 
message("GDAL_INCLUDE_DIRS: ${GDAL_INCLUDE_DIRS}") 
message("GDAL_LIBRARIES: ${GDAL_LIBRARIES}") 
message("GDAL_VERSION: ${GDAL_VERSION}") 
else() 
message("GDAL not found") 
endif() 

BQ_END

Running cmake indicates that GDAL_FOUND is true, GDAL_VERSION is set to the expected value(3.5.0), but GDAL_LIBRARIES and GDAL_INCLUDE_DIRS are empty: 

BQ_BEGIN

GDAL Found! 
GDAL_INCLUDE_DIRS: 
GDAL_LIBRARIES: 
GDAL_LIBRARY: 
GDAL_VERSION: 3.5.0 

BQ_END

Why are GDAL_LIBRARIES and GDAL_INCLUDE_DIR empty? 

Thanks 
Tom 


BQ_BEGIN



BQ_END


-------------------------------------------------- 
Thomas C. O'Reilly 
Monterey Bay Aquarium Research Institute 
7700 Sandholdt Road 
Moss Landing, California 95039-9644 
831-775-1766 (voice) 
831-775-1620 (FAX) 
oreilly at mbari.org (email) 
http://www.mbari.org (World-wide Web) 

"The machine does not isolate us from the great mysteries 
of nature, but plunges us more deeply into them." 

- ANTOINE DE SAINT-EXUPERY 
"Wind, Sand, and Stars" (1939) 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220606/eeb8aff2/attachment.htm>


More information about the gdal-dev mailing list