jrl-umi3218 / jrl-cmakemodules

CMake utility toolbox
https://jrl-cmakemodules.readthedocs.io/en/master/
Other
59 stars 45 forks source link

CMakeLists.txt: dont include base #673

Closed nim65s closed 7 months ago

nim65s commented 7 months ago

Hi,

This follow #670, and fix the case where this project is used with FetchContent, because FetchContent would detect the new CMakeLists.txt and execute it.

Then, if this CMakeLists.txt includes base.cmake, multiple global targets are created in the FetchContent and an error is raised later, in the downstream project() initialization, as its own include of base.cmake would try to define again the same global targets.

Of course, the proper fix would be to gracefully allow multiple inclusions of base.cmake, but that's a lot of work.

Instead, this PR only get what's need to generate CMake export in CMakeLists.txt.