Skip to content

Fix compilation error: Compatibility with CMake < 3.5 Removed #4704

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

brenocq
Copy link

@brenocq brenocq commented Apr 11, 2025

This update resolves compilation errors and warnings when building Bullet3 with CMake 3.27. The changes include:

  1. CMake Minimum Version Error Fix:
    Bullet3’s CMakeLists.txt now requires a minimum of CMake 3.5.

    • Change: Bump the minimum required CMake version from 2.4.3 to 3.5.
    • Reason: Compatibility with versions older than 3.5 has been removed, resulting in compilation errors when using CMake 3.27 (see cmake_minimum_required documentation).

    The error message encountered was:

     CMake Error at build/release/_deps/bullet3-src/CMakeLists.txt:1 (cmake_minimum_required):
     Compatibility with CMake < 3.5 has been removed from CMake.
    
     Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
     to tell CMake that the project requires at least <min> but has been updated
     to work with policies introduced by <max> or earlier.
    
     Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
  2. Find OpenGL Warning Fix:

    • Change: Set the CMake policy CMP0072 to NEW.
    • Reason: This ensures that the modern GLVND libraries are preferred when available, eliminating warnings about ambiguous OpenGL library selection.

    The related warning was:

     CMake Warning (dev) at /usr/share/cmake/Modules/FindOpenGL.cmake:415 (message):
     Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
     available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
     cmake_policy command to set the policy and suppress this warning.
    
     FindOpenGL found both a legacy GL library:
    
       OPENGL_gl_LIBRARY: /usr/lib/libGL.so
    
     and GLVND libraries for OpenGL and GLX:
    
       OPENGL_opengl_LIBRARY: /usr/lib/libOpenGL.so
       OPENGL_glx_LIBRARY: /usr/lib/libGLX.so
    
     OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
     compatibility with CMake 3.10 and below the legacy GL library will be used.
     Call Stack (most recent call first):
       CMakeLists.txt:317 (FIND_PACKAGE)
     This warning is for project developers.  Use -Wno-dev to suppress it.
    

These modifications resolve the current build issues and improve compatibility with the latest release of CMake.

brenocq added 2 commits April 11, 2025 11:02
Resolve a warning in FindOpenGL by setting the CMP0072 policy to NEW.
This change ensures that the modern GLVND libraries are preferred when available,
eliminating the warning about ambiguous OpenGL library selection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant