diff --git a/src/external/glfw/CMakeLists.txt b/src/external/glfw/CMakeLists.txt index 3c7ac8192..6063b46a1 100644 --- a/src/external/glfw/CMakeLists.txt +++ b/src/external/glfw/CMakeLists.txt @@ -304,10 +304,12 @@ endif() # Export GLFW library dependencies #-------------------------------------------------------------------- foreach(arg ${glfw_PKG_DEPS}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}") + set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}" CACHE INTERNAL + "GLFW pkg-config Requires.private") endforeach() foreach(arg ${glfw_PKG_LIBS}) - set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}") + set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}" CACHE INTERNAL + "GLFW pkg-config Libs.private") endforeach() #-------------------------------------------------------------------- diff --git a/src/external/glfw/README.md b/src/external/glfw/README.md index daa1be9ca..8b849f1a8 100644 --- a/src/external/glfw/README.md +++ b/src/external/glfw/README.md @@ -146,6 +146,10 @@ information on what to include when reporting a bug. - [X11] Bugfix: Content scale fallback value could be inconsistent (#1578) - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432) - [NSGL] Removed enforcement of forward-compatible flag for core contexts + - Export CMake `GLFW_PKG_DEPS` and `GLFW_PKG_LIBS` to parent scope for use + in client pkg-configs (#1307) +- Added a `glfw_objlib` CMake OBJECT library target for embedding into static + libraries (#1307) ## Contact diff --git a/src/external/glfw/src/CMakeLists.txt b/src/external/glfw/src/CMakeLists.txt index 6cbeed6d6..8db786eaf 100644 --- a/src/external/glfw/src/CMakeLists.txt +++ b/src/external/glfw/src/CMakeLists.txt @@ -92,31 +92,35 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR COMPILE_FLAGS -Wdeclaration-after-statement) endif() -add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) +add_library(glfw_objlib OBJECT ${glfw_SOURCES} ${glfw_HEADERS}) +add_library(glfw $) +set_target_properties(glfw_objlib PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(glfw PROPERTIES OUTPUT_NAME ${GLFW_LIB_NAME} VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR} SOVERSION ${GLFW_VERSION_MAJOR} - POSITION_INDEPENDENT_CODE ON FOLDER "GLFW3") if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.1.0") - set_target_properties(glfw PROPERTIES C_STANDARD 99) + set_target_properties(glfw_objlib PROPERTIES C_STANDARD 99) else() # Remove this fallback when removing support for CMake version less than 3.1 - target_compile_options(glfw PRIVATE + target_compile_options(glfw_objlib PRIVATE "$<$:-std=c99>" "$<$:-std=c99>" "$<$:-std=c99>") endif() -target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H) +target_compile_definitions(glfw_objlib PRIVATE _GLFW_USE_CONFIG_H) +target_include_directories(glfw_objlib PUBLIC + "$" + "$") target_include_directories(glfw PUBLIC "$" - "$") -target_include_directories(glfw PRIVATE + "$") +target_include_directories(glfw_objlib PRIVATE "${GLFW_SOURCE_DIR}/src" "${GLFW_BINARY_DIR}/src" ${glfw_INCLUDE_DIRS}) @@ -125,11 +129,11 @@ target_include_directories(glfw PRIVATE # the inclusion of stddef.h (by glfw3.h), which is itself included before # win32_platform.h. We define them here until a saner solution can be found # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. -target_compile_definitions(glfw PRIVATE +target_compile_definitions(glfw_objlib PRIVATE "$<$:UNICODE;WINVER=0x0501>") # Enable a reasonable set of warnings (no, -Wextra is not reasonable) -target_compile_options(glfw PRIVATE +target_compile_options(glfw_objlib PRIVATE "$<$:-Wall>" "$<$:-Wall>" "$<$:-Wall>") @@ -151,10 +155,10 @@ if (BUILD_SHARED_LIBS) set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib") endif() - target_compile_definitions(glfw INTERFACE GLFW_DLL) + target_compile_definitions(glfw_objlib INTERFACE GLFW_DLL) elseif (APPLE) # Add -fno-common to work around a bug in Apple's GCC - target_compile_options(glfw PRIVATE "-fno-common") + target_compile_options(glfw_objlib PRIVATE "-fno-common") set_target_properties(glfw PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}") @@ -162,7 +166,7 @@ if (BUILD_SHARED_LIBS) if (UNIX) # Hide symbols not explicitly tagged for export from the shared library - target_compile_options(glfw PRIVATE "-fvisibility=hidden") + target_compile_options(glfw_objlib PRIVATE "-fvisibility=hidden") endif() target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES}) @@ -171,7 +175,7 @@ else() endif() if (MSVC) - target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) + target_compile_definitions(glfw_objlib PRIVATE _CRT_SECURE_NO_WARNINGS) endif() if (GLFW_INSTALL)