gdal icon indicating copy to clipboard operation
gdal copied to clipboard

GDAL/PROJ CMake interaction hits a CMake limitation

Open mmomtchev opened this issue 3 years ago • 2 comments

Expected behavior and actual behavior.

GDAL/PROJ CMake interaction hits a CMake limitation

The problem comes from the fact that PROJ exports 4 different targets (proj/proj4 combinations). If I manually remove those from the PROJ CMakeLists, everything works normally.

Steps to reproduce the problem.

If I include both PROJ and GDAL in a super CMakeLists supposed to build them with an application with:

add_subdirectory(deps/proj)
add_subdirectory(deps/gdal)

I get

CMake Error: install(EXPORT "gdal-export" ...) includes target "GDAL" which requires target "proj" that is not in this export set, but in multiple other export sets: lib/cmake/proj/proj-targets.cmake, lib/cmake/proj/proj4-targets.cmake, lib/cmake/proj4/proj-targets.cmake, lib/cmake/proj4/proj4-targets.cmake.
An exported target cannot depend upon another target which is exported multiple times. Consider consolidating the exports of the "proj" target to a single export.

Operating system

Ubuntu 20.04 64 bit

GDAL version and provenance

GDAL 3.5.0-git

mmomtchev avatar Apr 23 '22 09:04 mmomtchev

I guess this is more a PROJ issue, and that should be resolved in the future, but not short term, by https://github.com/OSGeo/PROJ/issues/3168

rouault avatar Apr 23 '22 10:04 rouault

Any progress on this? What's the current recommended way to bundle both proj and gdal in the same CMake project?

Maxxen avatar Sep 14 '22 11:09 Maxxen