Add pkg-config GLFW3 support

This commit is contained in:
Clownacy 2020-04-01 22:42:27 +01:00
parent 135365f941
commit 1e0f0ed99c

View file

@ -406,8 +406,32 @@ if(NOT FORCE_LOCAL_LIBS)
endif() endif()
if(BACKEND_PLATFORM MATCHES "GLFW3") if(BACKEND_PLATFORM MATCHES "GLFW3")
find_package(glfw3 REQUIRED) if(NOT FORCE_LOCAL_LIBS)
find_package(glfw3)
if (PKG_CONFIG_FOUND)
pkg_check_modules(glfw3 QUIET glfw3)
endif()
endif()
if(glfw3_FOUND)
# pkg-config
if (PKG_CONFIG_STATIC_LIBS)
message(STATUS "Using system GLFW3 (pkg-config, static)")
target_compile_options(CSE2 PRIVATE ${glfw3_STATIC_CFLAGS})
target_link_libraries(CSE2 PRIVATE ${glfw3_STATIC_LIBRARIES})
else()
message(STATUS "Using system GLFW3 (pkg-config, dynamic)")
target_compile_options(CSE2 PRIVATE ${glfw3_CFLAGS})
target_link_libraries(CSE2 PRIVATE ${glfw3_LIBRARIES})
endif()
elseif(TARGET glfw)
# CMake
message(STATUS "Using system GLFW3 (CMake)")
target_link_libraries(CSE2 PRIVATE glfw) target_link_libraries(CSE2 PRIVATE glfw)
else()
message(FATAL_ERROR "Couldn't find GLFW3")
endif()
endif() endif()
if(BACKEND_PLATFORM MATCHES "SDL2" OR BACKEND_AUDIO MATCHES "SDL2") if(BACKEND_PLATFORM MATCHES "SDL2" OR BACKEND_AUDIO MATCHES "SDL2")