Utilize pkg-config for finding FTGL also under Windows

The mingw-w64 FTGL package provided by MSYS2 is using the autotools build
script and therefore only contains the pkg-config file. This change allows
to build PianoBooster using MSYS2 packaging.
This commit is contained in:
Martchus 2023-12-26 21:35:32 +01:00
parent 2e860f6370
commit d714ead991
1 changed files with 12 additions and 11 deletions

View File

@ -160,23 +160,24 @@ endif ()
# find FTGL
if (USE_FTGL)
if (NOT WIN32)
if (WIN32)
find_package(FTGL)
# add include path for freetype2 as ftgl uses freetype2 headers but doesn't pull in the include path automatically
if (FTGL_FOUND AND COMMAND pkg_check_modules)
pkg_check_modules(FREETYPE2 freetype2)
if (FREETYPE2_FOUND)
list(APPEND FTGL_INCLUDE_DIR "${FREETYPE2_INCLUDE_DIRS}")
endif ()
endif ()
endif ()
if (NOT FTGL_FOUND)
pkg_check_modules(FTGL ftgl)
if (NOT FTGL_FOUND)
message(FATAL_ERROR "FTGL was not found")
endif (NOT FTGL_FOUND)
set(FTGL_INCLUDE_DIR ${FTGL_INCLUDE_DIRS})
set(FTGL_LIBRARY ${FTGL_LIBRARIES})
else ()
find_package(FTGL REQUIRED)
# add include path for freetype2 as ftgl uses freetype2 headers but doesn't pull in the include path automatically
if (COMMAND pkg_check_modules)
pkg_check_modules(FREETYPE2 freetype2)
if (FREETYPE2_FOUND)
list(APPEND FTGL_INCLUDE_DIR "${FREETYPE2_INCLUDE_DIRS}")
endif ()
endif ()
endif ()
else (USE_FTGL)
add_compile_options("-DNO_USE_FTGL")