3

I have set up a C++ project using Conan and Cmake. I have executed the following commands:

conan install . --install-folder cmake-build-release --build=missing
cmake . -DCMAKE_TOOLCHAIN_FILE=cmake-build-release/conan_toolchain.cmake
cmake --build .

When building my main.cpp I get the following error:

/mnt/f/Projekte/rmldemo/src/main.cpp:1:24: fatal error: RmlUi/Core.h: No such file or directory

                        ^
compilation terminated.
CMakeFiles/rmlui_project.dir/build.make:75: recipe for target 'CMakeFiles/rmlui_project.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/rmlui_project.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/rmlui_project.dir/all' failed
make[1]: *** [CMakeFiles/rmlui_project.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2

My CmakeLists.txt:

cmake_minimum_required(VERSION 3.15)
project(rmlui_project CXX)

find_package(rmlui)

add_executable(${PROJECT_NAME} src/main.cpp)

# Use the global target
target_link_libraries(${PROJECT_NAME} rmlui::rmlui)

My conanfile.txt:

[requires]
rmlui/4.3

[generators]
CMakeDeps
CMakeToolchain

My main.cpp:

#include <RmlUi/Core.h>
#include <RmlUi/Core/StreamMemory.h>
#include <RmlUi/Core/TransformPrimitive.h>
#include <RmlUi/Debugger.h>
#include "Backends/RmlUi_Backend.h"
#include "Shell/Shell.h"
  • You could run `make` with additional `VERBOSE=1` option and check whether include directories for RmlUi are actually added (with `-I` option) when your executable is compiled. – Tsyvarev Jun 12 '22 at 17:54
  • 1
    It is possible that you are missing the ``cmake -DCMAKE_TOOLCHAIN... -DCMAKE_BUILD_TYPE=Release``, if it is a single-configuration environment (otherwise it would be necessary ``cmake --build . --config Release``) – drodri Jun 12 '22 at 17:57

0 Answers0