cpp-best-practices / gui_starter_template

A template CMake project to get you started with C++ and tooling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Builds fail for CMake < 3.18

joeperri95 opened this issue · comments

Recently a change was put in to use the package_project function from the project_options library.

This function asserts the policy CMP0103 which was introduced in CMake 3.18

This is causing builds to fail for CMake 3.16 which is the currently defined minimum and is what is available in the docker environment.

It looks like this was addressed in main branch of project_options but there is no release yet.

I don't maintain this project in this organization. It uses an old version of project_options that I have no control over.

This is my official template:
https://github.com/aminya/cpp_vcpkg_project

On the latest project_options, there is already a condition to skip this policy check on older CMake.

https://github.com/aminya/project_options/blob/main/src/PackageProject.cmake#L8

Not saying that there is any problem with project_options just that it will not work for CMake < 3.18 with the latest release v0.19.0. The policy skip has not yet been included in a published release so the maintainer of this project can't just bump a version number yet.

For the record your template project will have the same issue for CMake < 3.18.

@joeperri95, well observed.

I think this is an issue with cpp-best-practices/cpp_boilerplate_project, and should be discussed/solved there (I think you can do that with the 'Transfer Issue' button on the right).

You are correct that we could solve this problem by switching a newer version of project_options. That will not happen immediately though. In my opinion, it makes more sense just to bump our minimum CMake requirement up to 3.18. Up-to-date versions of CMake are really easy to install via pip.

I think the larger issue here is that we should test the minimum required versions of our tools in CI, and keep these up-to-date in our documentation. Our README specifies that you can use clang 6 or gcc 7, or any compiler that supports C++17. This is no longer true, since the project requires C++20. Conceivably, you could manually set CMAKE_CXX_STANDARD to C++17 and expect the project to work, but since we aren't testing that, we don't know that it will work and we shouldn't tell our users that it will.

@joeperri95 I released a new version. My template is updated now.

Duplicate of: cpp-best-practices/cmake_conan_boilerplate_template#17

Now closing, since it is more appropriate to handle this upstream. If you disagree, I will reopen this.