cmakecygwin

Cmake on Cygwin: CMake Error: Could not find CMAKE_ROOT


I installed Cmake 3.28.3 using Cygwin installer.

However, cmake produces CMake Error: Could not find CMAKE_ROOT !!!:

$ /bin/cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/share/cmake-3.28.3
cmake version 3.28.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

I installed Cmake 3.25.3 using Cygwin installer.

However, cmake produces CMake Error: Could not find CMAKE_ROOT !!!:

$ /bin/cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/share/cmake-3.25.3
cmake version 3.25.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

System information:

$ uname -a
CYGWIN_NT-10.0-19045 xxx 3.5.3-1.x86_64 2024-04-03 17:25 UTC x86_64 Cygwin

I've already tried to relaunch Cygwin and to reboot the OS. No effect.

Any ideas why this happen and how to fix?


Solution

  • Your Workaround is the wrong one.

    $ /bin/cmake
    CMake Error: Could not find CMAKE_ROOT !!!
    CMake has most likely not been installed correctly.
    ....
    

    instead

    $ /usr/bin/cmake
    Usage
    
      cmake [options] <path-to-source>
      cmake [options] <path-to-existing-build>
      cmake [options] -S <path-to-source> -B <path-to-build>
      ...
    

    This is is due to the historical peculiarity that on Cygwin /bin and /usr/bin are the same directory

    $ mount
    D:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
    D:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
    ...
    

    But the package was built as almost all package with /usr/bin in mind and all relative directories start for that one

    $ cygcheck -l cmake | grep bin
    /usr/bin/ccmake.exe
    /usr/bin/cmake.exe
    /usr/bin/cpack.exe
    /usr/bin/ctest.exe
    ...
    

    GCC compiler has the same settings.
    This is the reason why the PATH should contain only /usr/bin and NOT /bin. See /etc/profile for standard setting.