Skip to content

Commit 6826322

Browse files
donny-dontaperezdc
authored andcommitted
Create GL::egl target without pkgconfig
The if statement used `EGL_LIBRARIES` which was never created when not using the pkgconfig path so the `GL::egl` target wasn't there. Modify the check to use `EGL_LIBRARY`. Add the `FOUND_VAR` to the `find_package_handle_standar_args` and add a way to set the name of the EGL implementation.
1 parent cbe71a0 commit 6826322

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmake/FindEGL.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ find_path(
3939
)
4040
find_library(
4141
EGL_LIBRARY
42-
NAMES egl EGL
42+
NAMES ${EGL_NAMES} egl EGL
4343
HINTS ${EGL_LIBDIR} ${EGL_LIBRARY_DIRS}
4444
)
4545
mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)
4646

4747
# If pkg-config has not found the module but find_path+find_library have
4848
# figured out where the header and library are, create the PkgConfig::EGL
4949
# imported target anyway with the found paths.
50-
#
51-
if (EGL_LIBRARIES AND NOT TARGET GL::egl)
50+
if (EGL_LIBRARY AND NOT TARGET GL::egl)
5251
add_library(GL::egl INTERFACE IMPORTED)
5352
if (TARGET PkgConfig::EGL)
5453
set_property(TARGET GL::egl PROPERTY INTERFACE_LINK_LIBRARIES PkgConfig::EGL)
@@ -59,4 +58,7 @@ if (EGL_LIBRARIES AND NOT TARGET GL::egl)
5958
endif ()
6059

6160
include(FindPackageHandleStandardArgs)
62-
find_package_handle_standard_args(EGL REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR)
61+
find_package_handle_standard_args(EGL
62+
FOUND_VAR EGL_FOUND
63+
REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR
64+
)

0 commit comments

Comments
 (0)