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
Is your feature request related to a problem? Please describe.
Bad diagnostics if one forgets to find Umpire before linking to the CMake target.
Describe the solution you'd like
CMake targets would be namespaced with Umpire::, e.g. Umpire::umpire.
Describe alternatives you've considered
Do nothing.
Additional context
It's generally considered good practice to namespace exported CMake targets to avoid conflicts with other packages. The name conflict concern is lower in this case. Namespacing makes it clear that this is a CMake target and not a plain library. If one is linking with target_link_libraries(target umpire) but one has forgotten to find Umpire first there will eventually be a linking error with a plain
/nix/store/f4qnwzv6y0nq8lix33jr5ykkyybs6fxf-binutils-2.40/bin/ld: cannot find -lumpire: No such file or directory
This does not tell me that I forgot to find Umpire.
On the other hand, if the target is Umpire::umpire and I forget to find Umpire I instead get during configuration:
CMake Warning (dev) at CMakeLists.txt:4 (target_link_libraries):
Policy CMP0028 is not set: Double colon in target name means ALIAS or
IMPORTED target. Run "cmake --help-policy CMP0028" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Target "test" links to:
Umpire::umpire
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
This warning is for project developers. Use -Wno-dev to suppress it.
which is far clearer. Depending on if the above is an error or not it may continue with
/nix/store/f4qnwzv6y0nq8lix33jr5ykkyybs6fxf-binutils-2.40/bin/ld: cannot find -lUmpire::umpire: No such file or directory
which is a clear sign that it's trying to use a CMake target as a plain library.
For additional context, this didn't come up for me in the main project configuration, but in a generated PackageConfig.cmake file which was missing find_dependency(Umpire), where it's much easier to forget to find a package.
I think it may be as simple as adding NAMESPACE UMPIRE to this call:
Is your feature request related to a problem? Please describe.
Bad diagnostics if one forgets to find
Umpire
before linking to the CMake target.Describe the solution you'd like
CMake targets would be namespaced with
Umpire::
, e.g.Umpire::umpire
.Describe alternatives you've considered
Do nothing.
Additional context
It's generally considered good practice to namespace exported CMake targets to avoid conflicts with other packages. The name conflict concern is lower in this case. Namespacing makes it clear that this is a CMake target and not a plain library. If one is linking with
target_link_libraries(target umpire)
but one has forgotten to findUmpire
first there will eventually be a linking error with a plainThis does not tell me that I forgot to find
Umpire
.On the other hand, if the target is
Umpire::umpire
and I forget to findUmpire
I instead get during configuration:which is far clearer. Depending on if the above is an error or not it may continue with
which is a clear sign that it's trying to use a CMake target as a plain library.
For additional context, this didn't come up for me in the main project configuration, but in a generated
PackageConfig.cmake
file which was missingfind_dependency(Umpire)
, where it's much easier to forget to find a package.I think it may be as simple as adding
NAMESPACE UMPIRE
to this call:Umpire/CMakeLists.txt
Line 157 in 2957fb2
The text was updated successfully, but these errors were encountered: