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
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.
The text was updated successfully, but these errors were encountered:
Godot version
Any
godot-cpp version
a42b363
System information
any
Issue description
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 stack overflow question summs up the issues and provides adequate reading and resources to understand in more depth.
https://stackoverflow.com/questions/72931527/how-can-i-avoid-clashes-with-targets-imported-with-fetchcontent-makeavailable
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.
The text was updated successfully, but these errors were encountered: