conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.31k stars 986 forks source link

fix: quote template CMake variables #17156

Closed skycaptain closed 1 month ago

skycaptain commented 1 month ago

Changelog: Bugfix: Fix cppstd/cstd variable_watch when they are not defined. Changelog: Bugfix: Fix cstd error reporting when a recipe does not support the required version. Docs: Omit

This fix addresses an issue where "cppstd" is undefined for pure C recipes. Consequently, "set" sometimes leaves the "conan_watched_std_variable" unset, leading to an error in the subsequent string comparison:

CMake Error at .../conan_toolchain.cmake:64 (if):
  if given arguments:

    "READ_ACCESS" "STREQUAL" "MODIFIED_ACCESS" "AND" "NOT" "11" "STREQUAL"

  Unknown arguments specified
CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

skycaptain commented 1 month ago

Great catch! I wish I had figured this would be a possibility when adding it!

Maybe adding a simple test for this would be great, let us know if you need help with that :)

Done.

AbrilRBS commented 1 month ago

Thanks @skycaptain - The test also uncovered a bug in the cstd error reporting, so that's 2 for 1!

Either way, I'm proposing https://github.com/conan-io/conan/pull/17157 to fix the cstd error while removing some slight duplication

AbrilRBS commented 1 month ago

The current test error is due to a missconfiguration for functional tests on our side:

The provided compiler.cstd=11 requires at least msvc>=192 but version 191 provided pinging @memsharded who implemented the feature in the first place and might better know where to bump the necessary values :)