LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
7.98k stars 995 forks source link

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

Open PJ-Finlay opened 6 years ago

PJ-Finlay commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

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. https://github.com/LMMS/lmms/blob/8d00e90322710ed3dd8ce1a4bdcc83f18b64d59b/CMakeLists.txt#L7-L16

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

PhysSong commented 6 years ago

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. https://github.com/LMMS/lmms/blob/8d00e90322710ed3dd8ce1a4bdcc83f18b64d59b/plugins/zynaddsubfx/CMakeLists.txt#L32-L38 I don't know how should we handle this. Any ideas?

lukas-w commented 6 years ago

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.

Rossmaxx commented 5 months ago

Any chance #6780 might have fixed this?

PhysSong commented 5 months ago

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 commented 5 months ago

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

Rossmaxx commented 5 months ago

till then, we needn't bother.

DomClark commented 5 months ago

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.