robotology / ycm-cmake-modules

YCM (YCM CMake modules) is a collection of various useful CMake modules.
http://robotology.github.io/ycm-cmake-modules
Other
50 stars 22 forks source link

Respect YCM_USE_CMAKE_NEXT also when bootstrapping with FetchContent and fix compatibility of YCM_USE_CMAKE_NEXT=OFF with CMP0114 set to NEW #452

Closed traversaro closed 1 month ago

traversaro commented 1 month ago

The YCM_USE_CMAKE_NEXT variable (that by default is considered ON) can be used to avoid using the vendored external project by setting it to OFF . However, the variable was not properly observed when YCM was used via FetchContent. This PR fixes this.

This is useful for dealing with https://github.com/robotology/ycm-cmake-modules/issues/50, as with this change it is possible to avoid using the vendored ExternalProject by just setting YCM_USE_CMAKE_NEXT to OFF (as we do in https://github.com/robotology/robotology-superbuild/pull/1672).

traversaro commented 1 month ago

Apparently being this untested, the YCM code is not working with upstream ExternalProject anymore:

CMake Warning (dev) at /usr/local/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
  Calling FetchContent_Populate(YCM) is deprecated, call
  FetchContent_MakeAvailable(YCM) instead.  Policy CMP0169 can be set to OLD
  to allow FetchContent_Populate(YCM) to be called directly for now, but the
  ability to call it with declared details will be removed completely in a
  future version.
Call Stack (most recent call first):
  cmake/YCMBootstrapFetch.cmake:103 (FetchContent_Populate)
  CMakeLists.txt:60 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/local/share/cmake-3.[30](https://github.com/robotology/robotology-superbuild/actions/runs/9919319898/job/27404998904#step:13:31)/Modules/ExternalProject.cmake:1991 (message):
  The 'NO_DEPENDS' option is no longer allowed.  It has been superseded by
  the per-step 'INDEPENDENT' option.  See policy CMP0114.
Call Stack (most recent call first):
  build/_deps/ycm-src/modules/YCMEPHelper.cmake:380 (ExternalProject_Add_StepTargets)
  build/_deps/ycm-src/modules/YCMEPHelper.cmake:1078 (_ycm_ep_add_update_step)
  cmake/BuildYCM.cmake:8 (ycm_ep_helper)
  build/_deps/ycm-src/modules/FindOrBuildPackage.cmake:205 (include)
  cmake/BuildYARP.cmake:8 (find_or_build_package)
  build/_deps/ycm-src/modules/FindOrBuildPackage.cmake:205 (include)
  cmake/RobotologySuperbuildLogic.cmake:68 (find_or_build_package)
  CMakeLists.txt:67 (include)

see https://github.com/robotology/robotology-superbuild/actions/runs/9919319898/job/27404998904 .

GitHub
Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robotology/robotology-superbuild@22149fb
CMake/YCM-based superbuild to simplify the build process of robotology projects. - Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robo...
CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

traversaro commented 1 month ago

Apparently being this untested, the YCM code is not working with upstream ExternalProject anymore:

CMake Warning (dev) at /usr/local/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
  Calling FetchContent_Populate(YCM) is deprecated, call
  FetchContent_MakeAvailable(YCM) instead.  Policy CMP0169 can be set to OLD
  to allow FetchContent_Populate(YCM) to be called directly for now, but the
  ability to call it with declared details will be removed completely in a
  future version.
Call Stack (most recent call first):
  cmake/YCMBootstrapFetch.cmake:103 (FetchContent_Populate)
  CMakeLists.txt:60 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/local/share/cmake-3.[30](https://github.com/robotology/robotology-superbuild/actions/runs/9919319898/job/27404998904#step:13:31)/Modules/ExternalProject.cmake:1991 (message):
  The 'NO_DEPENDS' option is no longer allowed.  It has been superseded by
  the per-step 'INDEPENDENT' option.  See policy CMP0114.
Call Stack (most recent call first):
  build/_deps/ycm-src/modules/YCMEPHelper.cmake:380 (ExternalProject_Add_StepTargets)
  build/_deps/ycm-src/modules/YCMEPHelper.cmake:1078 (_ycm_ep_add_update_step)
  cmake/BuildYCM.cmake:8 (ycm_ep_helper)
  build/_deps/ycm-src/modules/FindOrBuildPackage.cmake:205 (include)
  cmake/BuildYARP.cmake:8 (find_or_build_package)
  build/_deps/ycm-src/modules/FindOrBuildPackage.cmake:205 (include)
  cmake/RobotologySuperbuildLogic.cmake:68 (find_or_build_package)
  CMakeLists.txt:67 (include)

see https://github.com/robotology/robotology-superbuild/actions/runs/9919319898/job/27404998904 .

GitHubPass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robotology/robotology-superbuild@22149fbCMake/YCM-based superbuild to simplify the build process of robotology projects. - Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robo...

This was fixed in https://github.com/robotology/ycm-cmake-modules/pull/452/commits/a7e40ece9b61d987bc1d3185131570f9a615ceb5 .

GitHub
Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robotology/robotology-superbuild@22149fb
CMake/YCM-based superbuild to simplify the build process of robotology projects. - Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robo...
traversaro commented 1 month ago

As this is working fine (see https://github.com/robotology/robotology-superbuild/actions/runs/9919382871/job/27405509850), let's merge and do a release.

GitHub
Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robotology/robotology-superbuild@4d24d5a
CMake/YCM-based superbuild to simplify the build process of robotology projects. - Pass YCM_USE_CMAKE_NEXT set to OFF in normal-build (i.e. apt with gha image and vcpkg on windows) workflow · robo...