'How to include glew library in cmake file

How to include library in cmake.

The path for the glew header files is"

 C:\VizPlugins_Library\Library\glew\glew-2.1.0\include\GL"

The path for library is

 C:\VizPlugins_Library\Library\glew\glew-2.1.0\lib\Release\x64

with the lib file having name

 "glew32.lib"

The path for dll file

  C:\VizPlugins_Library\Library\glew\glew-2.1.0\bin\Release\x64

The name of the file is

 glew32.dll

How to include the glew package path in the cmake file.

This is the cmake file.

make_minimum_required(VERSION 3.0)

project(ocean)

include_directories(include)

link_directories(${CMAKE_SOURCE_DIR}/lib)
include_directories(${CMAKE_BINARY_DIR}/include)



set(ENGINE_NAME engine)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "-O4")
set(BUILD_SHARED_LIBS True)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_BUILD_TYPE Release)

find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(GLM REQUIRED)
find_package(GLFW3 REQUIRED)

set(LIBS glfw3 gdi32 opengl32 glew32)

include_directories(
    "${CMAKE_SOURCE_DIR}/src"
    "${CMAKE_SOURCE_DIR}/include"
)

file(GLOB_RECURSE SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${LIBS})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source