Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake_minimum_required() uses "...", which is a feature available in 3.12 onward leading to broken configuration #9237

Closed
aleksandaratanasov opened this issue Aug 1, 2022 · 6 comments
Labels
cmake not-a-curl-bug This is not a bug in curl

Comments

@aleksandaratanasov
Copy link

I did this

Added curl as a submodule to my project to use as a dependency. No changes have been done to the contents of the master branch.

Using Visual Studio 2017 I ran (from the CMake menu) the cache generation.

I expected the following

Properly configured curl as a dependency.

Instead I received an error regarding the version and that it is either too short or too long. I checked CMakeLists.txt and found cmake_minimum_required(VERSION 3.2...3.16 FATAL_ERROR). Based on the official CMake documentation the use of ... to specify a policy range (in this case between 3.2 and 3.16) this feature has been introduced in 3.12.

Solution

Either remove the ... and check if curl can actually still be configured with as low as CMake 3.2 or increase the minimum to 3.12. Note that at least on my machine VS2017 is shipped with 3.11. Older versions of VS will have even bigger issues and upgrading CMake that is shipped as an extension for the IDE is non-existent and one needs to wait for the VS team at Microsoft to ship one.

curl/libcurl version

Latest from master branch.

operating system

Windows 10 Pro 64bit

@aleksandaratanasov
Copy link
Author

Just as a test I removed the cmake_minimum_required() from the project. Following configuration and build step in VS2017 didn't exhibit any issues whatsoever.

@jzakrzewski
Copy link
Contributor

From the link you've posted:

If the running version of CMake is older than 3.12, the extra ... dots will be seen as version component separators, resulting in the ... part being ignored and preserving the pre-3.12 behavior of basing policies on .

@bagder bagder added the cmake label Aug 2, 2022
@bagder
Copy link
Member

bagder commented Aug 10, 2022

I second @jzakrzewski on this: the cmake documentation quite clearly says that this syntax works in older versions too.

@aleksandaratanasov
Copy link
Author

Did you guys try the CMake shipped with Visual Studio? Please note that VS ships its own version, which (at least up to 2017 included) is impossible to be replaced by another one. I will check with a standard installation of CMake (have that too) and hopefully it will work (as you have said).

@jzakrzewski
Copy link
Contributor

It's not CMake that throws errors but VS 2017 itself trying to analyse the version string.
See: CMake issue and VS Issue for reference.

@bagder bagder added the not-a-curl-bug This is not a bug in curl label Aug 11, 2022
@bagder
Copy link
Member

bagder commented Aug 11, 2022

This is clearly not our bug and not even a cmake bug, but a problem with Visual Studio. You also seem to have found an easy and simple work-around to get this working for you.

I do not think there's any action left for us to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake not-a-curl-bug This is not a bug in curl
Development

No branches or pull requests

3 participants