Skip to content
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

Running Cmake warns you about Policy CMP0072 not being set #4499

Open
PJ-Finlay opened this issue Jul 22, 2018 · 10 comments
Open

Running Cmake warns you about Policy CMP0072 not being set #4499

PJ-Finlay opened this issue Jul 22, 2018 · 10 comments

Comments

@PJ-Finlay
Copy link
Contributor

PJ-Finlay commented Jul 22, 2018

When you run Cmake version 3.11.2 you get this error:

CMake Warning (dev) in src/CMakeLists.txt:
  Policy CMP0071 is not set: Let AUTOMOC and AUTOUIC process GENERATED files.
  Run "cmake --help-policy CMP0071" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  For compatibility, CMake is excluding the GENERATED source file(s):

    "/home/pj/Desktop/lmms/build/src/embedded_resources.h"

  from processing by AUTOMOC.  If any of the files should be processed, set
  CMP0071 to NEW.  If any of the files should not be processed, explicitly
  exclude them by setting the source file property SKIP_AUTOMOC:

    set_property(SOURCE file.h PROPERTY SKIP_AUTOMOC ON)

This is the policy that isn't being set, and is similar to #3985. I can make a pull request to fix this.

@tresf
Copy link
Member

tresf commented Jul 30, 2018

@PJ-Finlay which branch?

I can make a pull request to fix this.

PRs are always welcome but if you're on stable-1.2 it may just be an artifact of that branch.

@PhysSong
Copy link
Member

PRs are always welcome but if you're on stable-1.2 it may just be an artifact of that branch.

Confirmed. stable-1.2 has the issue while master doesn't.
embedded_resources.h is removed in master via #1891.

@PJ-Finlay
Copy link
Contributor Author

Sorry for the late response. I didn't realize that this was already partially changed in master. Using master I'm still getting these two errors though:

CMake Deprecation Warning at CMakeLists.txt:13 (CMAKE_POLICY):
  The OLD behavior for policy CMP0050 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
CMake Warning (dev) at /usr/share/cmake/Modules/FindOpenGL.cmake:270 (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/lib64/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib64/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib64/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):
  /usr/share/cmake/Modules/FindFLTK.cmake:82 (find_package)
  CMakeLists.txt:398 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

For the first one it seems like we're setting the CMP0050 to use the old version of this policy which is deprecated.

lmms/CMakeLists.txt

Lines 7 to 16 in 8d00e90

IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0005 NEW)
CMAKE_POLICY(SET CMP0003 NEW)
IF (CMAKE_MAJOR_VERSION GREATER 2)
CMAKE_POLICY(SET CMP0026 NEW)
CMAKE_POLICY(SET CMP0045 NEW)
CMAKE_POLICY(SET CMP0050 OLD)
ENDIF()
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF(COMMAND CMAKE_POLICY)

For CMP0072 I think we just need to explicit set which type of OpenGL library is being used to suppress the warning.

@PhysSong
Copy link
Member

I think we don't need CMP0050 on master because #4421 removed use of SOURCE. @lukas-w Right?
The CMP0072 is because root CMakeLists.txt doesn't set FLTK_SKIP_OPENGL when finding FLTK while plugins/zynaddsubfx/CMakeLists.txt does.

SET(FLTK_SKIP_OPENGL TRUE)
SET(FLTK_SKIP_FORMS TRUE)
SET(FLTK_SKIP_IMAGES TRUE)
SET(FLTK_SKIP_MATH TRUE)
IF(MINGW_PREFIX)
SET(FLTK_SKIP_FLUID TRUE)
ENDIF()

I don't know how should we handle this. Any ideas?

@lukas-w
Copy link
Member

lukas-w commented Aug 21, 2018

I think we don't need CMP0050 on master because #4421 removed use of SOURCE. @lukas-w Right?

Right.

The CMP0072 is because root CMakeLists.txt doesn't set FLTK_SKIP_OPENGL when finding FLTK while plugins/zynaddsubfx/CMakeLists.txt does.

Should we move the set(FLTK_SKIP_xxx ) calls to CMakeLists.txt? They need to be set before calling FIND_PACKAGE(FLTK), right now they're set afterwards.

@PhysSong PhysSong changed the title Running Cmake warns you about Policy CMP0071 not being set Running Cmake warns you about Policy CMP0072 not being set Mar 23, 2022
@Rossmaxx
Copy link
Contributor

Any chance #6780 might have fixed this?

@PhysSong
Copy link
Member

Any chance #6780 might have fixed this?

No, CMP0072 is introduced in CMake 3.11, and the PR doesn't touch anything related to CMP0072.

@Rossmaxx
Copy link
Contributor

oh so if i understand right, to set the policy, we must update cmake.

@Rossmaxx
Copy link
Contributor

till then, we needn't bother.

@DomClark
Copy link
Member

This may have been fixed in #6561, where the set(FLTK_SKIP_xxx) commands were moved to the root CMakeLists.txt above the find_package(FLTK) command.

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

No branches or pull requests

6 participants