Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ else()
message(FATAL_ERROR "OpenGL ES 3 support is currently only available for Linux platforms. You're building for ${CMAKE_SYSTEM_NAME}.")
endif()

# We use a local find script for OpenGL::GLES3 until the proposed changes are merged upstream.
list(APPEND CMAKE_MODULE_PATH "${PROJECTM_SOURCE_DIR}/cmake/gles")
if (CMAKE_VERSION VERSION_LESS_EQUAL "3.22" OR CMAKE_SYSTEM_NAME STREQUAL Android)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked CMake's sources to be sure and saw there that the GLES2 and GLES3 targets were actually added to CMake's find module in version 3.27 and not in v3.23 as I was expecting when I wrote the ReadMe in the module dir. So I think to be on the safe side, this should rather read:

Suggested change
if (CMAKE_VERSION VERSION_LESS_EQUAL "3.22" OR CMAKE_SYSTEM_NAME STREQUAL Android)
if (CMAKE_VERSION VERSION_LESS_EQUAL "3.26" OR CMAKE_SYSTEM_NAME STREQUAL Android)

Ditto in the package config file.

Copy link
Member

@kblaschke kblaschke Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(If you want, you can update the ReadMe.md in cmake/gles accordingly.)

# We use a local find script for OpenGL::GLES3 until the proposed changes are merged upstream.
list(APPEND CMAKE_MODULE_PATH "${PROJECTM_SOURCE_DIR}/cmake/gles")
endif()
find_package(OpenGL REQUIRED COMPONENTS GLES3)
if(NOT TARGET OpenGL::GLES3)
message(FATAL_ERROR "No suitable GLES3 library was found.")
Expand Down
4 changes: 3 additions & 1 deletion src/libprojectM/projectM4Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ include(CMakeFindDependencyMacro)

if(NOT "@ENABLE_EMSCRIPTEN@") # ENABLE_EMSCRIPTEN
if("@ENABLE_GLES@") # ENABLE_GLES
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
if (CMAKE_VERSION VERSION_LESS_EQUAL "3.22" OR CMAKE_SYSTEM_NAME STREQUAL Android)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
endif()
find_dependency(OpenGL COMPONENTS GLES3)
Comment on lines +9 to 12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better only temporarily append the current dir to the module path, like this:

Suggested change
if (CMAKE_VERSION VERSION_LESS_EQUAL "3.22" OR CMAKE_SYSTEM_NAME STREQUAL Android)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
endif()
find_dependency(OpenGL COMPONENTS GLES3)
if (CMAKE_VERSION VERSION_LESS_EQUAL "3.22" OR CMAKE_SYSTEM_NAME STREQUAL Android)
set(PROJECTM4_PREV_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_dependency(OpenGL COMPONENTS GLES3)
set(CMAKE_MODULE_PATH ${PROJECTM4_PREV_MODULE_PATH})
else()
find_dependency(OpenGL COMPONENTS GLES3)
endif()

This will still allow the calling CMake project to override the find module, but will load projectM's module before the CMake-supplied one, and doesn't add unexpected paths to the module dir list.

else()
find_dependency(OpenGL)
Expand Down
Loading