0

I am setting up a C++ CLion project to learn OpenGL, I started by adding the GLFW dependency with Conan on a WSL system on Windows, and I can't manage to include the GLFW headers after successfully configuring my CMake project.

I am using :

  • CLion 2020.3 with a configured WSL toolchain
  • CMake 3.10.2
  • Conan 1.32.1
  • GLFW 3.3.2, from the conan-center remote

I can manage to run the Getting started example of conan without any issues, but installing GLFW seems to be a bit more involved than poco. I can locate the desired header in the .conan directory, but for some reason it is not visible at link time, a piece is missing here.

Code

CMakeLists.txt :

cmake_minimum_required(VERSION 3.10)
project(learn_opengl)

set(CMAKE_CXX_STANDARD 14)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_executable(learn_opengl main.cpp)
message("CONAN LIBS: ${CONAN_LIBS}")
conan_target_link_libraries(learn_opengl ${CONAN_LIBS})

conanfile.txt

[requires]
glfw/3.3.2

[generators]
cmake

The error at compile-time :

main.cpp:2:10: fatal error: GLFW\glfw3.h: No such file or directory
 #include <GLFW\glfw3.h>

I have to dive deeper to understand the compilation process here and the way Conan and CMake interact, any help or shortcut would be great as I find myself a bit clueless here, many thanks.

joubs
  • 123
  • 8

0 Answers0