question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[package] any: CMake Header-only package with a `compiler` setting fail to build on Windows

See original GitHub issue

CMake 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

/cc @Croydon @SSE4

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:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jgsogocommented, Jul 17, 2020

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

0reactions
Minimoniumcommented, Jul 17, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[fmt] build failure with CMake, MinGW #17979 - GitHub
Host Environment OS: Windows 10 x64 19042.985 Compiler: GCC 10.2.0 ... The complete CMake setup with {fmt} and Quill builds fine from vcpkg...
Read more >
Error installing header only package via conan - Stack Overflow
When uploading Conan packages you need to be explicit when you want to upload binary packages too. The command conan upload kvapi* -r ......
Read more >
C++: Compiling, Linking, and CMake
A header file is a file that typically contains declarations of existing code: in other words, they typically signify the existence of an...
Read more >
Cross Platform Make - CMake
CMake is a cross-platform, open-source build system. CMake is part of a family of tools designed to build, test and package software.
Read more >
Fatal Error C1083 | Microsoft Learn
The compiler generates a C1083 error when it can't find a file it ... as part of your build, consider using vcpkg, a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found