Linking GLEW with CMake

前端 未结 5 733
甜味超标
甜味超标 2020-12-03 13:45

How can you link GLEW to a project with CMake?

We\'ve been trying to link GLEW to our project using CMake for at least 3 hours without any success so any help is acc

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 14:03

    Other answers do obviously work, but the target based style of cmake makes it even easier since the GLEW find module defines the imported target GLEW::GLEW. All you need is:

    find_package(GLEW REQUIRED)
    target_link_libraries(YourTarget GLEW::GLEW)
    

    YourTarget is the target that you created with add_executable or add_library. No need to explicitly add include directories, they are added automatically by linking the targets.

提交回复
热议问题