glfw/glfw

Uninstalling installed files yields Cmake warnings

gruelingpine185 opened this issue · 9 comments

Just for cleanliness I created a Makefile recipe that handles building and deleting built project dependancies. GLFW (3.3-stable) is among them. I'm using the following command from within my project's Makefile to uninstall GLFW. It works as intended but it leaves behind some warnings that it says are for "project developers".

make -C vendor/glfw/build uninstall

The warning:

CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

This warning gets repeated for each file that gets uninstalled. For your convenience, this is the output I receive from running cmake --help-policy CMP0153:

exo ➜ cmake --help-policy CMP0153
CMP0153
-------

.. versionadded:: 3.28

The ``exec_program()`` command should not be called.

This command has long been superseded by the ``execute_process()``
command and has been deprecated since CMake 3.0.

CMake >= 3.28 prefer that this command never be called.
The ``OLD`` behavior for this policy is to allow the command to be called.
The ``NEW`` behavior for this policy is to issue a ``FATAL_ERROR`` when the
command is called.

This policy was introduced in CMake version 3.28.
CMake version 3.28.2 warns when the policy is not set and uses
``OLD`` behavior.  Use the ``cmake_policy()`` command to set it to ``OLD`` or
``NEW`` explicitly.

.. note::
  The ``OLD`` behavior of a policy is
  ``deprecated by definition``
  and may be removed in a future version of CMake.

Quick question:

  • I do wish to make a contribution to fix this, but I'm not sure which branch I should base the PR on. Should I do base it off of 3.3-stable since this is the branch I encountered it on or is there a preferred branch for minute things like this?
  • And would a minor fix something like this warrant a change log entry and credits? If so awesome!
  • Oh, and which branch should be used and what's the difference (or intent) behind master, latest, and 3.3-stable? It's always confused me.

Do let me know as I wish to fix it.

Below is the full output of the uninstall command.

make -C vendor/glfw/build uninstall
-- Uninstalling "/usr/local/lib/libglfw3.a"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/include/GLFW/glfw3.h"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/include/GLFW/glfw3native.h"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/lib/cmake/glfw3/glfw3Config.cmake"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/lib/cmake/glfw3/glfw3ConfigVersion.cmake"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/lib/cmake/glfw3/glfw3Targets.cmake"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/lib/cmake/glfw3/glfw3Targets-noconfig.cmake"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Uninstalling "/usr/local/lib/pkgconfig/glfw3.pc"
CMake Warning (dev) at cmake_uninstall.cmake:12 (exec_program):
  Policy CMP0153 is not set: The exec_program command should not be called.
  Run "cmake --help-policy CMP0153" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Use execute_process() instead.
This warning is for project developers.  Use -Wno-dev to suppress it.

Built target uninstall

From what I understand, this is only a 3 character fix. I understand that isn't a pressing issue like the others, but it is an issue nonetheless. So may I fix this?

I'm a bit busy at the moment so will just write up some quick info:

I do wish to make a contribution to fix this, but I'm not sure which branch I should base the PR on. Should I do base it off of 3.3-stable since this is the branch I encountered it on or is there a preferred branch for minute things like this?

All PRs should be based off master.

And would a minor fix something like this warrant a change log entry and credits? If so awesome!

Normally yes, unless we think someone is Github credit farming.

Oh, and which branch should be used and what's the difference (or intent) behind master, latest, and 3.3-stable? It's always confused me.

We intend to document this but haven't' gotten around to it yet, here's a short summary:

  • master (also called main which we may switch to in future) this is the primary development branch and should be used as the base for all PRs.
  • latest gets updated to the most recent major, minor or patch release after each release.
  • x.x-stable branched from its release tag on main, receives cherry-picked bug fixes for patch releases in parallel with the next minor or major release.

So may I fix this?

We welcome PRs but they do take time to get merged as there is a lot of outstanding work.

Thanks so much for your response. Sorry I was a little impatient. I'll make the PR and have it close this issue :)

No problem - however do leave this issue open until the PR is merged or this issue is otherwise resolved.

This turned out to be a little more than I can handle considering I do not know cmake very well. I have decided to let the the GLFW team (or anyone else) work on this issue. This is as far as I've gotten:

@@ -9,16 +9,16 @@ string(REGEX REPLACE "\n" ";" files "${files}")
 foreach (file ${files})
   message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
   if (EXISTS "$ENV{DESTDIR}${file}")
-    exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
-                 OUTPUT_VARIABLE rm_out
-                 RETURN_VALUE rm_retval)
+    execute_process(COMMAND CMAKE_COMMAND ARGS "-E rm \"$ENV{DESTDIR}${file}\""
+                    OUTPUT_VARIABLE rm_out
+                    RESULT_VARIABLE rm_retval)
     if (NOT "${rm_retval}" STREQUAL 0)
       MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
     endif()
   elseif (IS_SYMLINK "$ENV{DESTDIR}${file}")
-    EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
-                 OUTPUT_VARIABLE rm_out
-                 RETURN_VALUE rm_retval)
+    execute_process(COMMAND CMAKE_COMMAND ARGS "-E rm \"$ENV{DESTDIR}${file}\""
+                    OUTPUT_VARIABLE rm_out
+                    RESULT_VARIABLE rm_retval)
     if (NOT "${rm_retval}" STREQUAL 0)
       message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"")
     endif()

And it fails to delete the files, exiting with exit code 2: "No such file or directory" although it still exists.


Sources I looked at while trying to get this to work:

I no longer see who put the message up with code that solved the issue, but whoever it was, thank you :)

I just ran it and it got rid of the warnings, but the files remain.

I think this is the correct approach,

execute_process(COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}"
                OUTPUT_VARIABLE rm_out
                RESULT_VARIABLE rm_retval)

I can't try to figure it out right now, but I can try tomorrow and see if I have any success with it.