-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake policy CMP0072 #360
Comments
Further reference: https://cmake.org/cmake/help/git-stage/policy/CMP0072.html I think the better behavior is to check if the policy exists and make use of the newer version. This shouldn't have any impact on our current cmake mechanisms, as far as I can tell:
I believe we also need to propagate it out to the |
A bit more background on what this error mean (to make a better informed decision): The context is switchable graphics. Eons ago drivers would replace libGL.so with their own and call it a day. But today it is very normal to have multiple GPUs installed (specially laptops with switchable graphics between Intel and NVIDIA; AMD + Intel combo isn't a problem because they are both provided by Mesa so it's the same libGL.so) So a new library was made, libOpenGL.so, which decides at launch time which libGL.so to launch. This interface is known as GLVND. If configured properly launching:
will give you different output (assuming you have NVIDIA + Intel or AMD using Mesa) Today it works out of the box if using the NVIDIA installer (no need to mess with xorg.conf), but Ubuntu 20.04's packaged NVIDIA drivers broke this (maybe on purpose?) as trying to use mesa will give X11 interface errors. So basically the error is saying link against libOpenGL instead of libGL to better support switchable graphics. Ogre 2.1+ uses Ogre 1.x uses a very similar way to load OpenGL so it should be working, but I didn't check it. Hence this CMake warning probably can be safely ignored because we don't actually link against libGL or libOpenGL during build time; unless you have other tools (other than Ogre) linking against GL directly. |
I tried a few things here but I wasn't able to silence the warning while still using if (POLICY CMP0072)
cmake_policy (SET CMP0072 NEW)
endif(POLICY CMP0072)
ign_find_package(OpenGL
REQUIRED_BY ogre ogre2
PKGCONFIG gl) if (POLICY CMP0072)
cmake_policy (SET CMP0072 NEW)
endif(POLICY CMP0072)
ign_find_package(OpenGL
REQUIRED_BY ogre ogre2
PKGCONFIG gl
EXTRA_ARGS NO_POLICY_SCOPE) if(POLICY CMP0072)
cmake_policy(PUSH)
cmake_policy(SET CMP0072 NEW)
endif()
ign_find_package(OpenGL
REQUIRED_BY ogre ogre2
PKGCONFIG gl)
if(POLICY CMP0072)
cmake_policy(POP)
endif() This does work, but we lose the if (POLICY CMP0072)
cmake_policy (SET CMP0072 NEW)
endif(POLICY CMP0072)
find_package(OpenGL) Other things that I thought of trying:
Does anyone have a better idea? Now that Jenkins CI is using Focal (gazebo-tooling/release-tools#565) this warning is turning the build yellow. |
What about setting I guess push/pop policy doesn't make sense in this case because once FindOpenGL has executed, the effects are irreversible (variables are set with OGL libs and folders), even if the policy is popped |
Thanks, that does it! #528 That's still not propagated to downstream projects though, not sure if |
Fixed by #528 |
Environment
Description
Steps to reproduce
Compile from source with a CMake version higher than 3.10
Solution
If we want to keep compatibility with CMake 3.10, I think we should explicitly set the policy to
OLD
.The text was updated successfully, but these errors were encountered: