I am going mad trying to get CMake, Emscripten and Conan 2 playing together.
First thing I tried was just using conan-cmake's develop2 branch, which supports conan 2 but fails with setting unknown compiler versions to the generated profile file. So I decided to try without conan-cmake.
The project is built using emcmake cmake .. && cmake --build .
from the build directory, after activating Emscripten, sourcing their env script. Everything works as long there is non conan.
The problem is, that conan want's me to use their generated CMake toolchain file. But as soon as I do, the one set by emcmake
is not used anymore. Setting both manually does not work, too.
There is no documentation from the conan 2 developers regarding Emscripten. Only thing I could find was some Conan 1.x docs. Is Conan 2 totally unusable for anything not yet totally simple or am I doing something wrong?
I got it working the following way:
emscripten.profile
Installing via
conan install
:This outputs a
conan_toolchain.cmake
file into thebuild
directory, which sets up CMake for Conan with Emscripten.Running CMake using the generated Toolchain file:
It was pretty unclear to me how to use Emscripten, if Conan already wants you to set a
CMAKE_TOOLCHAIN_FILE
. The Conan documentation for version 1.x includes notes about Emscripten, while the version 2.x documentation does not.