[gdal-dev] Building GDAL in WIndows with CLion (CMake)

Luis Felipe Romero felipe at uma.es
Wed Apr 19 07:42:16 PDT 2023


Hi all

I'll tell you about my experience installing the GDAL development environment on a fresh Windows 11 computer using CMake with CLION. I'm only sharing this so that in the future, this message may be useful to someone.

Before installing GDAL, prepare three tools (always installed the latest version for all users, as administrator):

     Python for Windows, as admin, adding the PATH to the environment variable. Ver. 3.11
     Git for Windows (Updating PATH)
     CLion for Windows 20231.1 (PATH as well)
     OSGEO4W (I installed it without knowing it was necessary. I needed QGIS, although later I found out that it was necessary for some dependencies)

After opening the GDAL folder with CLion, I found out that I needed some additional tools (Swig and Proj)

Swig for Windows.

     Simply unzip the swigwin-4.1.1.zip folder and set the following variable:

     SWIG_EXECUTABLE=D:\utils\swig\swig.exe

Proj for Windows and some dependencies:

     After reading around, I found out that it was recommended to use OSGEO4W, and later I found out that I needed to install the sources and some dependencies.

     proj
     proj-devel
     libtiff
     libtiff-devel
     libgeotiff
     libgeotiff-devel
     curl
     curl-devel

Previously, I had already installed this with OSGEO4W, so there could be some more dependencies installed:

     gdal
     qgis

Finally, I defined these environment variables:

     PROJ_INCLUDE_DIR=C:\OSGeo4W\include
     PROJ_LIBRARY_RELEASE=C:\OSGeo4W\bin\proj_9_2.dll

And add this line in CMakeLists.txt below project(gdal LANGUAGES C CXX)

     set(PROJ_ROOT "c:\OSGEO4W")

After refreshing CMake, it compiled smoothly, without any problems.

Thank you, Javier Jimenez Shaw, for your tips :)



More information about the gdal-dev mailing list