I want to package my conan project on Windows. When I use this host profile conan always tries to find a compiler corresponding to Unix Makefiles:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
Which then yields the following error:
..
cojson/0.1.0: Calling build()
cojson/0.1.0: Running CMake.configure()
cojson/0.1.0: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:/Users/Samuel/.conan2/p/b/cojsoab8131f7efa0a/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/Samuel/.conan2/p/b/cojsoab8131f7efa0a/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "C:\Users\Samuel\.conan2\p\b\cojsoab8131f7efa0a\b"
Der Befehl "." ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
The last bit translates to "the command "." is either misspelled or could not be found. Invoking the command seperately yields more informative results:
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
I get that I have no compiler corresponding to Unix Makefiles installed. But how can I hint conan in the direction that I want to use MinGW?
I tried
to set a build_env variable of the host settings to hint the generator to CMake:
[buildenv]
CMAKE_GENERATOR="MingGW Makefiles"
However of course that doesn't work as the -G option is passed by conan which overwrites environment variables.
I can't find any conan2 (!) documentation on how I can switch generators.
I also tried to switch settings.os to Windows instead of Linux to nudge Conan in the right direction but still same output.
To select a particular generator, add
tools.cmake.cmaketoolchain:generator=MinGW Makefilesto the[conf]section of your profile.You probably should specify that you're on Windows instead of
os=Linuxas well.