Wie kann ich GLFW in einem neuen Clion -Projekt hinzufügen?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie kann ich GLFW in einem neuen Clion -Projekt hinzufügen?

by Anonymous » 31 Aug 2025, 12:22

Ich möchte Libraires und dergleichen importieren, aber ich konnte bisher nichts importieren und verwenden ... Ich habe die Binärdateien für GLFW heruntergeladen und den Ordner des Include -Ordners in den Root -Ordner meines Clion -Projekts kopiert. Und was dann? Ich soll es verknüpfen, aber wie?

Code: Select all

====================[ Build | LearnOpenGL | Debug ]=============================
"C:\Program Files\CMake\bin\cmake.exe" --build C:\dev\LearnOpenGL\cmake-build-debug --target LearnOpenGL -j 10
[0/1] Re-running CMake...
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.

Update the VERSION argument  value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

CMake Error at CMakeLists.txt:6 (find_package):
By not providing "FindGLFW.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GLFW", but
CMake did not find one.

Could not find a package configuration file provided by "GLFW" with any of
the following names:

GLFWConfig.cmake
glfw-config.cmake

Add the installation prefix of "GLFW" to CMAKE_PREFIX_PATH or set
"GLFW_DIR" to a directory containing one of the above files.  If "GLFW"
provides a separate development package or SDK, be sure it has been
installed.

ninja: error: rebuilding 'build.ninja': subcommand failed
-- Configuring incomplete, errors occurred!
FAILED: build.ninja
"C:\Program Files\CMake\bin\cmake.exe" --regenerate-during-build -SC:\dev\LearnOpenGL -BC:\dev\LearnOpenGL\cmake-build-debug
< /code>
Bisher sieht meine cmakelists.txt so aus ... < /p>
cmake_minimum_required(VERSION 3.0)
project(LearnOpenGL)

set(CMAKE_CXX_STANDARD 23)

find_package(GLFW REQUIRED)

add_executable(LearnOpenGL main.cpp)

include_directories(./include)
target_link_libraries("${CMAKE_PROJECT_NAME}" PRIVATE glfw)
< /code>
Projektstruktur ist so etwas wie: < /p>
Root
|-- include
|  |-- GLFW
|  |  |-- glfw3.h
|  |  |-- glfwnative.h
|-- CMakeLists.txt
|-- main.cpp
< /code>
Aber es ist nicht verlinkt oder so ... nicht sicher.cmake_minimum_required(VERSION 3.0)
project(LearnOpenGL)

set(CMAKE_CXX_STANDARD 23)

add_executable(main main.cpp)

include(cmake/CPM.cmake)
CPMAddPackage("gh:glfw/glfw#3.4")
CPMAddPackage("gh:Dav1dde/glad#v2.0.6")

target_link_libraries(main glad glfw)
Aber jetzt ist es froh, dass das überhaupt nicht arbeiten möchte ...

Top