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

CMake 3.30 regression on Linux #450

Closed traversaro closed 2 weeks ago

traversaro commented 2 weeks ago

Test failure:

4/5 Test #4: RunCMake.cmake-next ...............***Failed    1.14 sec
-- find_package_Doxygen - PASSED
-- find_package_GLEW - PASSED
CMake Error at /home/runner/work/ycm-cmake-modules/ycm-cmake-modules/tests/RunCMake/RunCMake.cmake:135 (message):
  find_package_Matlab - FAILED:

  Result is [1], not [0].

  stderr does not match that expected.

  Actual stdout:

   actual-out> Not searching for unused variables given on the command line.
   actual-out> -- Found YCM: /home/runner/work/ycm-cmake-modules/ycm-cmake-modules/build (found version "0.16.4~20240709")
   actual-out> -- Configuring incomplete, errors occurred!

  Expected stderr to match:

   expect-err> ^$

  Actual stderr:

   actual-err> CMake Error at /usr/share/miniconda3/envs/test/share/cmake-3.30/Modules/FindThreads.cmake:66 (message):
   actual-err>   FindThreads only works if either C or CXX language is enabled
   actual-err> Call Stack (most recent call first):
   actual-err>   /usr/share/miniconda3/envs/test/share/cmake-3.30/Modules/FindMatlab.cmake:303 (find_package)
   actual-err>   find_package_Matlab.cmake:1 (find_package)
   actual-err>   CMakeLists.txt:8 (include)

Call Stack (most recent call first):
  /home/runner/work/ycm-cmake-modules/ycm-cmake-modules/tests/RunCMake/cmake-next/RunCMakeTest.cmake:5 (run_cmake)
traversaro commented 2 weeks ago

See https://gitlab.kitware.com/cmake/cmake/-/issues/25564 . The triggered check seems quite old (https://gitlab.kitware.com/cmake/cmake/-/commit/9924a212f671dfcc2b20d2a29da23bc440247f19), so perhaps there was some kind of implicit dependency on C/C++ being enabled that is not true anymore in CMake 3.30 .

GitLab
Threads should either trigger language enablement, or not rely on it (#25564) · Issues · CMake / CMake · GitLab
Consider the following CMakeLists: make_minimum_required(VERSION 3.25 FATAL_ERROR)
GitLab
FindThreads: replace CheckIncludeFiles by CheckIncludeFile (9924a212) · Commits · CMake / CMake · GitLab
While at it, also add a branch using CheckIncludeFileCXX. Also give a better error message if no supported language is enabled. C++ support isn't working yet, but it has never...
traversaro commented 2 weeks ago

The problem is https://gitlab.kitware.com/cmake/cmake/-/issues/26121 . As FindMatlab is not contained anymore in ycm-cmake-modules, it does not make a lot of sense to have this test in ycm.

GitLab
find_package(Matlab) makes the CMake configuration error if NONE LANGUAGES are enabled (#26121) · Issues · CMake / CMake · GitLab
In CMake 3.30 the following project: cmake_minimum_required(VERSION 3.14)