You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CMake: Possible name clashes when depending on godot-cpp through add_subdirectory or FetchContent #1657
CMake is the gift that keeps giving.
While running some testing by separating the godot-cpp-test target into its own repo and fetching the godot-cpp source using the cmake FetchContent mechanism, it was brought to my attention that CMake has no current project level namespace mechanism to prevent target name collisions with adjacent or downstream projects.
This means that any consumers of godot-cpp will have to avoid/manage the target names we have defined ie. template_debug, template_release, editor, and godot-cpp-test.
This of course isnt a nice way to play in an ecosystem. Godot also provides the target alias mechanism, which we already use for godot-cpp::
I think it would be prudent to change the naming of the internal CMake targets to avoid clashes, something like godot-cpp.<target_name> works nicely.
The test target should also be disabled by default.
Steps to reproduce
To re-produce the issue:
A cmake c++ project
That uses find_package, add_subdirectory, or FetchContent to consume godot-cpp
That names their build targets the same as ours
Or consumes another library with the same target names as ours.
Minimal reproduction project
This issue is encountered when building an extension using cmake, prior to the use of a godot project.
Activity
enetheru commentedon Jan 11, 2025
this can be closed as #1658 has been merged
dsnopek commentedon Jan 11, 2025
Thanks!