cmake_minimum_required(VERSION 3.5) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 11) project(Test) find_package(glfw3 REQUIRED) add_executable(${PROJECT_NAME} src/glad.c main.cpp) target_link_libraries(${PROJECT_NAME} glfw) main.cpp #include <glad/glad.h> #include <GLFW/glfw3.h...
find_package(GLEW REQUIRED) find_package(PkgConfig REQUIRED) pkg_search_module(GLFW REQUIRED glfw3) include(CTest) enable_testing() add_executable(${PROJECT_NAME} GL_hello.cpp) set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) include(CPack) target_includ...
在上述代码中,我们首先指定了CMake的最低版本,并设置了项目名称。然后,我们使用add_executable命令添加了一个可执行文件,这里假设可执行文件的源代码文件为main.cpp。接下来,我们使用find_package命令查找GLFW库,并使用target_link_libraries命令将GLFW库链接到可执行文件中。 保存并关闭CMakeLists.txt文件。 在项目根...
然后使用find_package(glfw3 REQUIRED)查找glfw3库。这不会产生任何错误。实际上,CMakeLists.txt一点也不抱怨。然后 浏览2提问于2017-07-25得票数 3 回答已采纳 3回答 cmake: oglplus找不到上下文初始化库(glfw) 、 我尝试用cmake (在OSX10.9上使用Xcode 5/Clang5.0.0)构建 (C++ OpenGL包装器)。但要...
find_package(glfw3 REQUIRED) ② 带上CMAKE_TOOLCHAIN_FILE来配置项目:cmake -B [build directory] -S . "-DCMAKE_TOOLCHAIN_FILE=G:/svn/vcpkg/scripts/buildsystems/vcpkg.cmake" 在vscode中,可在workspace的settings.json文件cmake.configureSettings标签下,配置"CMAKE_TOOLCHAIN_FILE": "G:/svn/vcpkg/sc...
cmake_minimum_required(VERSION3.10)project(OpenGL)set(CMAKE_CXX_STANDARD14)#这里GLAD_INCLUDE目录填你自己存放的路径set(GLAD_INCLUDE /Users/fijiisland/Documents/Dependencies/glad/include)find_package(glfw3 REQUIRED)include_directories(${GLAD_INCLUDE})add_executable(OpenGL main.cpp glad.c)target_link_li...
find_package(glm CONFIG REQUIRED) add_executable(demo main.cpp) target_link_libraries(demo PUBLIC glad::glad PUBLIC glfw PUBLIC glm::glm ) 测试代码 #include<glad/glad.h> #include<GLFW/glfw3.h> #include<glm/glm.hpp> #include<glm/gtc/matrix_transform.hpp> ...
find_package(OpenGL REQUIRED) find_package(GLFW3 REQUIRED) 省略其他部分... target_link_libraries(OpenGLExecutable ${OPENGL_gl_LIBRARY} glfw # 其他库文件... ) 五、添加外部依赖 处理GLAD GLAD是OpenGL的扩展加载库。在包含GLAD之前,必须首先初始化它: ...
假设您正在使用 GLFW 和 GLEW 来管理 OpenGL,以下是一个修改后的 CMakeLists.txt 示例,用于链接 GLFW 和 GLEW,并解决链接错误: ```cmake cmake_minimum_required(VERSION 3.0) project(YourProjectName) # 查找 OpenGL 库 find_package(OpenGL REQUIRED) ...
find_package(glfw3 REQUIRED) find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIR}) include_directories(${OpenGL_INCLUDE_DIR}) link_directories(${OpenCV_LIBRARY_DIR}) link_directories(${OpenGL_LIBRARY_DIR}) add_executable(markerless_ar_demo ARDrawingContext.cpp ...