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
Really frustrating that there is a target named "vulkan" exactly in the glfw cmake project. I am working on an application that uses Vulkan with GLFW, so it shocked the hell out of me that this was an issue.
I really don't want to use ExternalProject or find_package for installed binaries, another nonsense. I want to just use add_subdirectory on both, but cannot.
Really REALLY wished cmake had an option in add_subdirectory for including targets in namepsaces to prevent this problem like:
My primary suggestion would be to use a package manager such as vcpkg or conan. I understand this may not be possible for you.
If not, then it's worth noting that find_package can also find build trees (uninstalled packages). With glfw it would be to clone and build it, then specifying the prefix to cmake. So to build your project, the cmake command should be:
cmake .. -DCMAKE_PREFIX_PATH=../../glfw
If you have many packages and don't want to list them all out, you also can set all the prefix path in a toolchain file:
The problem with add_subdirectory(...) is that you effectively says glfw are my sources. Which is not what you want. You also don't want to install all libraries into your system, which is totally understandable. Fortunately, find_package can also find other project on your system and can also have arbitrary installation folder, including a third_party directory in your project.
I know use that thing you don't want instead is not nice to get as an answer, but add_subdirectory won't resolve variable or target conflict since it's primarly meant to split one project into parts.
Really frustrating that there is a target named "vulkan" exactly in the glfw cmake project. I am working on an application that uses Vulkan with GLFW, so it shocked the hell out of me that this was an issue.
I really don't want to use ExternalProject or find_package for installed binaries, another nonsense. I want to just use add_subdirectory on both, but cannot.
Really REALLY wished cmake had an option in add_subdirectory for including targets in namepsaces to prevent this problem like:
add_subdirectory( glfw "some/path/to/glfw/subdir" NAMESPACE GLFW )
that would import all targets in the subdir with a prefixed namespace GLFW:, but sadly, this is not a feature in cmake (yet).
In the meantime, can we please make our target names a lot less ambiguous? Cmake is just not that good at this.
The text was updated successfully, but these errors were encountered: