Skip to content

problem to compile with cmake 4.0 #30

@filochard

Description

@filochard

Hi
Perhaps you know I continue to build rpms of OpenCPN and its plugins for a Linux distribution (Mageia)

We are preparing the next version of this distribution with GCC 15.0 and cmake 4.0 that allowed to discover a problem in all the CMakeLists.txt in the tree of s63_pi source
they all begin with
cmake_minimum_required(VERSION 3.1)
the problem is the same with the opencpn-libs linked to the tree
https://github.com/leamas/opencpn-libs/tree/9804fbeae263dc51f26fa8773c6796b82ceae5fd
this commit 9804fbe is quite old and all its CMakeLists.txt have the same problem

Cmake 4.0 is not compatible with old versions : all the CMakeLists.txt needs at least
cmake_minimum_required(VERSION 3.5)

Instead of patching each CMakeLists.txt I used a temporary workaround adding a line between %build and %cmake :
%build
export CMAKE_POLICY_VERSION_MINIMUM=3.5
%cmake

But if this workaround is enough for us now, that's not right for the plugin itself :
for s63_pi being compliant with new version of cmake you 'll need to correct all the CMakeLists.txt in your tree and to link it to a more recent commit of opencpn-libs (using the same as the one used for o-charts_pi .... it's recent enough ) :
https://github.com/OpenCPN/opencpn-libs/tree/facd6f684e8b851619a100e5601626e2002e1d42
in which all the CMakeLists.txt contain the line : cmake_minimum_required(VERSION 3.5)

I hope this will help to build for the future version of OpenCPN

Best Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions