0

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})
Summit
  • 2,112
  • 2
  • 12
  • 36
  • 2
    So, you have the code. Does it work? Or does it show an error message? Add that error message into the question post. – Tsyvarev Apr 21 '22 at 08:51
  • @Tsyvarev i don't know how to add the library paths to the code , this code does not have the paths to the library. – Summit Apr 21 '22 at 08:56
  • In other words, you got the error message like in [that question](https://stackoverflow.com/questions/40271558/cmake-cant-find-glew), am I right? In that case you could try the approach suggested in its answer. – Tsyvarev Apr 21 '22 at 09:04

0 Answers0