0

so im trying to add glew with cmake in clion and im getting error: Could NOT find GLEW (missing: GLEW_LIBRARIES) (found suitable version "2.2.0", minimum required is "2.2.0")

My CmakeLists.txt:

cmake_minimum_required(VERSION 3.22)
project(ProjectName)

set(CMAKE_CXX_STANDARD 23)

find_package(GLEW 2.2.0 REQUIRED)

add_executable(ProjectName src/main.cpp)

target_link_libraries(ProjectName GLEW::GLEW)

EDIT: I decided to #define GLEW_STATIC before inculing

minus1ms
  • 1
  • 1
  • No, there is nothing wrong with CMake. It tells you, that while it has succeeded in locating GLEW headers and extracts the version from them, it has failed to find GLEW **libraries**. What OS do you use and how have you installed GLEW? – Tsyvarev May 29 '22 at 13:48
  • I use Windows and i have glew next to source files... I was trying before adding glew in other ways but didnt worked – minus1ms May 29 '22 at 14:05
  • What compiler, GCC or MSVC? – HolyBlackCat May 29 '22 at 14:15
  • You need to have those libraries which are suitable for the way you build your project. E.g. If CLion is configured to build the project using MinGW, then it cannot use `.dll` and `.lib` libraries. – Tsyvarev May 29 '22 at 14:17
  • GCC compiler and I want to use glew from folder, I have src folder with .cpp files and next to src folder i have dependencies folder with glew-2.2.0 folder – minus1ms May 29 '22 at 14:19
  • @Tsyvarev For the record, modern MinGW can link directly to .dll without .a. I don't know if CMake knows that though. – HolyBlackCat May 29 '22 at 14:19
  • The easiest way to make CMake happy is probably to replace your GCC with the one from [MSYS2](https://stackoverflow.com/q/30069830/2752075), and install GLEW from it as a package. The second easiest way is to define `GLEW_STATIC` and to add `glew.cpp` directly to your project, without `find_package`. – HolyBlackCat May 29 '22 at 14:20
  • so option for me will be to define GLEW_STATIC – minus1ms May 29 '22 at 14:23
  • 1
    but i dont really know how to do that... I want later to #include in my source – minus1ms May 29 '22 at 14:32
  • Begin your comments with `@username` when replying, otherwise we don't get notifications. – HolyBlackCat May 29 '22 at 15:14
  • Just `#define GLEW_STATIC` before including glew. – HolyBlackCat May 29 '22 at 15:15
  • @HolyBlackCat its actually not working for me or i did something wrong – minus1ms May 29 '22 at 17:33
  • oh nvm i know what i did – minus1ms May 29 '22 at 17:35

0 Answers0