CMake can't find GLEW

This page summarizes the projects mentioned and recommended in the original post on /r/learnprogramming

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • GLFW

    A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

  • cmake_minimum_required(VERSION 3.16) project(P1_PR) add_executable(P1_PR src/main.cpp ) find_package(GLFW QUIET) if(NOT GLFW_FOUND) message(STATUS "GLFW not found, fetching from GitHub...") include(FetchContent) FETCHCONTENT_DECLARE( GLFW GIT_REPOSITORY https://github.com/glfw/glfw/ GIT_TAG 3.3.8 ) FetchContent_GetProperties(GLFW) if (NOT GLFW_POPULATED) set(FETCHCONTENT_QUIET NO) FetchContent_Populate(GLFW) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_GAMES OFF CACHE BOOL "" FORCE) add_subdirectory(${glfw_SOURCE_DIR} ${glfw_BINARY_DIR}) endif() endif() find_package(GLEW QUIET) if(NOT GLEW_FOUND) message(STATUS "GLEW not found, fetching from GitHub...") include(FetchContent) FETCHCONTENT_DECLARE( GLEW GIT_REPOSITORY https://github.com/Perlmint/glew-cmake GIT_TAG glew-cmake-2.2.0 ) FetchContent_GetProperties(GLEW) if (NOT GLEW_POPULATED) set(FETCHCONTENT_QUIET NO) FetchContent_Populate(GLEW) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_GAMES OFF CACHE BOOL "" FORCE) add_subdirectory(${glew_SOURCE_DIR} ${glew_BINARY_DIR}) endif() endif() target_include_directories(${PROJECT_NAME} PRIVATE ${GLFW_SOURCE_DIR} PRIVATE ${GLEW_SOURCE_DIR} ) target_link_libraries(${PROJECT_NAME} glfw glew32 opengl32 gdi32 glm ) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)

  • glew-cmake

    GLEW(https://github.com/nigels-com/glew, source updated nightly) with Cmake and pre-generated sources

  • cmake_minimum_required(VERSION 3.16) project(P1_PR) add_executable(P1_PR src/main.cpp ) find_package(GLFW QUIET) if(NOT GLFW_FOUND) message(STATUS "GLFW not found, fetching from GitHub...") include(FetchContent) FETCHCONTENT_DECLARE( GLFW GIT_REPOSITORY https://github.com/glfw/glfw/ GIT_TAG 3.3.8 ) FetchContent_GetProperties(GLFW) if (NOT GLFW_POPULATED) set(FETCHCONTENT_QUIET NO) FetchContent_Populate(GLFW) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_GAMES OFF CACHE BOOL "" FORCE) add_subdirectory(${glfw_SOURCE_DIR} ${glfw_BINARY_DIR}) endif() endif() find_package(GLEW QUIET) if(NOT GLEW_FOUND) message(STATUS "GLEW not found, fetching from GitHub...") include(FetchContent) FETCHCONTENT_DECLARE( GLEW GIT_REPOSITORY https://github.com/Perlmint/glew-cmake GIT_TAG glew-cmake-2.2.0 ) FetchContent_GetProperties(GLEW) if (NOT GLEW_POPULATED) set(FETCHCONTENT_QUIET NO) FetchContent_Populate(GLEW) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_GAMES OFF CACHE BOOL "" FORCE) add_subdirectory(${glew_SOURCE_DIR} ${glew_BINARY_DIR}) endif() endif() target_include_directories(${PROJECT_NAME} PRIVATE ${GLFW_SOURCE_DIR} PRIVATE ${GLEW_SOURCE_DIR} ) target_link_libraries(${PROJECT_NAME} glfw glew32 opengl32 gdi32 glm ) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts