[package] any: CMake Header-only package with a `compiler` setting fail to build on Windows
See original GitHub issueCMake build helper on Windows uses settings to determine which CMake generator to use. In older Conan versions the behavior was a failure in configure step, but since that, it seems to be fixed for the default case, so I failed to properly double-check that. My apologizes.
If there are no settings in a recipe - Conan delegates the generator detection to CMake. It may be a problem in some cases but I’ve failed to reproduce it (/cc @theodelrieu ):
When expliciting CC=cl.exe in a profile, and creating a package which declares no settings (nlohmann_json/3.8.0) Conan will not run the MSVC command tools prior to running CMake, thus the CMakeDetermineCCompiler.cmake script will fail
If a package requires a compile
setting for some unrelated work as a C++ standard support detection - it fails to configure the project because of faulty logic in here:
https://github.com/conan-io/conan/blob/develop/conans/client/build/cmake.py#L158
Affected recipes: https://github.com/conan-io/conan-center-index/pull/1946 https://github.com/conan-io/conan-center-index/pull/1945 https://github.com/conan-io/conan-center-index/pull/1939 https://github.com/conan-io/conan-center-index/pull/1936
Profile
[settings]
os=Windows
os_build=Windows
arch=x86
arch_build=x86
compiler=Visual Studio
compiler.version=16
compiler.toolset=v141
compiler.runtime=MDd
build_type=Debug
compiler.cppstd=17
[options]
[build_requires]
[env]
Example to reproduce
$ conan create ./recipes/kitten/all kitten/0.1.0@user/testing
Result
ERROR: kitten/0.1.0@user/testing: Error in build() method, line 48
cmake = self._configure_cmake()
while calling '_configure_cmake', line 34
cmake.configure(source_folder=self._source_subfolder,
ConanException: CMake does not support toolsets with generator "None:.Please check your conan profile to either remove the toolset, or change the CMake generator.
Note: It could happen that not all settings are required or not all
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
I think this issue would’ve been fixed (because CCI would’ve failed) if this PR were in place: https://github.com/conan-io/conan/pull/7327
@jgsogo Indeed!
Also, I think that this issue may be closed now since all the recipes affected were merged. If anyone wants to proceed with the discussion - feel free to open the issue.