CMAKE GLFW 链接问题
CMAKE GLFW linking problems
我想在 CLion 中通过 cmake 添加 glfw 依赖项,但出现奇怪的错误,这是 CMakeLists.txt
cmake_minimum_required(VERSION 3.17)
project(hello_gl)
set(CMAKE_CXX_STANDARD 14)
find_package(glfw3 3.3 REQUIRED)
target_link_libraries(hello_gl glfw)
add_executable(hello_gl main.cpp)
CMake Error at CMakeLists.txt:8 (target_link_libraries):
Cannot specify link libraries for target "hello_gl" which is not built by
this project.
这是我得到的错误?为什么cmake找不到我的app?
当我在添加可执行文件
后尝试linkglfw lib时,它起作用了
cmake_minimum_required(VERSION 3.17)
project(hello_gl)
set(CMAKE_CXX_STANDARD 14)
add_executable(hello_gl main.cpp)
find_package(glfw3 3.3 REQUIRED)
target_link_libraries(hello_gl glfw)
这里是对的CMakeLists.txt
我想在 CLion 中通过 cmake 添加 glfw 依赖项,但出现奇怪的错误,这是 CMakeLists.txt
cmake_minimum_required(VERSION 3.17)
project(hello_gl)
set(CMAKE_CXX_STANDARD 14)
find_package(glfw3 3.3 REQUIRED)
target_link_libraries(hello_gl glfw)
add_executable(hello_gl main.cpp)
CMake Error at CMakeLists.txt:8 (target_link_libraries):
Cannot specify link libraries for target "hello_gl" which is not built by
this project.
这是我得到的错误?为什么cmake找不到我的app?
当我在添加可执行文件
后尝试linkglfw lib时,它起作用了cmake_minimum_required(VERSION 3.17)
project(hello_gl)
set(CMAKE_CXX_STANDARD 14)
add_executable(hello_gl main.cpp)
find_package(glfw3 3.3 REQUIRED)
target_link_libraries(hello_gl glfw)
这里是对的CMakeLists.txt