skoleosho97
skoleosho97

Reputation: 293

CMake, Windows, fatal error: GLFW/glfw3.h: No such file or directory

Trying to build a project but I've been stuck trying to get my code to recognize my libraries.

I'm using Ninja as my build generator.

CMake txt file:

cmake_minimum_required(VERSION 3.15...3.31)
project(LearnOpenGL VERSION 0.1.0 LANGUAGES C CXX)

find_package(OpenGL REQUIRED)

add_subdirectory(deps)
add_executable(LearnOpenGL src/main.cpp)

target_link_libraries(LearnOpenGL PRIVATE glfw glad)
set_target_properties(glfw PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(LearnOpenGL PRIVATE "src/")

GLFW CMake txt file:

add_library(glfw
    "include/glfw3.h"
    "include/glfw3native.h"
)

target_include_directories(glfw PUBLIC "include/")

File structure:

.
├── build/
├── deps/
│   ├── glad/
│   │   ├── include/
│   │   │   ├── glad/
│   │   │   │   └── glad.h
│   │   │   └── KHR/
│   │   │       └── khrplatform.h
│   │   ├── src/
│   │   │   └── glad.c
│   │   └── CMakeLists.txt
│   ├── GLFW/
│   │   ├── include/
│   │   │   ├── glfw3.h
│   │   │   └── glfw3native.h
│   │   └── CMakeLists.txt
│   └── CMakeLists.txt
├── src/
│   └── main.cpp
└── CMakeLists.txt

Upvotes: 0

Views: 55

Answers (0)

Related Questions