cmake find_package、引用GDAL 初步学习

上次的源码的CMakeLists.txt文件里有 find_package(GDAL REQUIRED) 这句;

从字面意思看此源码需要GDAL库;

查了一下,find_package 指令的基本功能是查找第三方库,并返回其细节;
 

我当前GDAL安装在D:\GDAL;

先把它的CMakeLists.txt重命名为别的,不使用;

新建一个CMakeLists.txt,里面有三句,

cmake_minimum_required (VERSION 3.8)

project(Cesium3DTilesConverter VERSION 2.1.0)
find_package(GDAL REQUIRED)

单独看一下find_package(GDAL REQUIRED)运行起来是什么样子;

点Configure之后如下; 

cmake find_package、引用GDAL 初步学习_第1张图片

CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find GDAL (missing: GDAL_LIBRARY GDAL_INCLUDE_DIR) (found version
  "GDAL_VERSION-NOTFOUND")
Call Stack (most recent call first):
  ......
  CMakeLists.txt

你可能感兴趣的:(VC++,GIS,cmake,gdal)