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

Kai Pastor, DG0YT dg0yt at darc.de
Wed Apr 19 23:03:46 PDT 2023


These instructions seem unaware of the fact that builds are configured 
by passing input variables to cmake. In particular it is not necessary 
to edit CMakeList.txt, and some of the environment variables have no 
effect at all.

I don't know how this is done in CLion. On the command line, you would 
use `-D` parameters, i.e.

cmake ... "-DSWIG_EXECUTABLE=D:\utils\swig\swig.exe" 
"-DPROJ_ROOT=c:\OSGEO4W" ...

These variables are cached in the build directory. So you can easily 
have different configurations in different build directories for the 
same source directory, without having to remember setting environment 
variables.

Kai

Am 19.04.23 um 16:42 schrieb Luis Felipe Romero:
> 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 :)
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230420/8b810719/attachment.htm>


More information about the gdal-dev mailing list