2022-08-05 10:18:37 +08:00
|
|
|
diff --git a/cmake/SFMLConfig.cmake.in b/cmake/SFMLConfig.cmake.in
|
2023-06-24 04:23:10 +08:00
|
|
|
index 30194c5f..40b72309 100644
|
2022-08-05 10:18:37 +08:00
|
|
|
--- a/cmake/SFMLConfig.cmake.in
|
|
|
|
+++ b/cmake/SFMLConfig.cmake.in
|
|
|
|
@@ -1,3 +1,8 @@
|
|
|
|
+set(SFML_STATIC_LIBRARIES false)
|
|
|
|
+if(NOT "@BUILD_SHARED_LIBS@")
|
|
|
|
+ set(SFML_STATIC_LIBRARIES true)
|
|
|
|
+endif()
|
|
|
|
+include(CMakeFindDependencyMacro)
|
|
|
|
# This script provides the SFML libraries as imported targets
|
|
|
|
# ------------------------------------
|
|
|
|
#
|
|
|
|
diff --git a/cmake/SFMLConfigDependencies.cmake.in b/cmake/SFMLConfigDependencies.cmake.in
|
2023-06-24 04:23:10 +08:00
|
|
|
index 0737ec5d..05bf9a8f 100644
|
2022-08-05 10:18:37 +08:00
|
|
|
--- a/cmake/SFMLConfigDependencies.cmake.in
|
|
|
|
+++ b/cmake/SFMLConfigDependencies.cmake.in
|
2023-06-24 04:23:10 +08:00
|
|
|
@@ -35,9 +35,11 @@ if(SFML_STATIC_LIBRARIES)
|
2023-06-17 11:52:51 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
|
|
|
|
+ if(NOT ${THIS_FRIENDLY_NAME}_LIB)
|
|
|
|
find_library(${THIS_FRIENDLY_NAME}_LIB NAMES ${THIS_SEARCH_NAMES}
|
|
|
|
PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
|
|
|
|
mark_as_advanced(${THIS_FRIENDLY_NAME}_LIB)
|
|
|
|
+ endif()
|
|
|
|
if(${THIS_FRIENDLY_NAME}_LIB)
|
|
|
|
set_property(TARGET ${THIS_TARGET} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${${THIS_FRIENDLY_NAME}_LIB}")
|
|
|
|
else()
|
2023-06-24 04:23:10 +08:00
|
|
|
@@ -64,6 +66,9 @@ if(SFML_STATIC_LIBRARIES)
|
2022-08-05 10:18:37 +08:00
|
|
|
if (FIND_SFML_OS_WINDOWS)
|
|
|
|
set_property(TARGET OpenGL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "OpenGL32")
|
|
|
|
elseif(NOT FIND_SFML_OS_IOS)
|
|
|
|
+ set(OpenGL_GL_PREFERENCE "@EXPORT_OpenGL_GL_PREFERENCE@")
|
|
|
|
+ find_dependency(OpenGL)
|
|
|
|
+ set(OpenGL_LIB OpenGL::GL)
|
|
|
|
sfml_bind_dependency(TARGET OpenGL FRIENDLY_NAME "OpenGL" SEARCH_NAMES "OpenGL" "GL")
|
|
|
|
endif()
|
|
|
|
endif()
|
2023-06-24 04:23:10 +08:00
|
|
|
@@ -71,6 +76,8 @@ if(SFML_STATIC_LIBRARIES)
|
2022-08-05 10:18:37 +08:00
|
|
|
# sfml-graphics
|
|
|
|
list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT_INDEX)
|
|
|
|
if(FIND_SFML_GRAPHICS_COMPONENT_INDEX GREATER -1)
|
|
|
|
+ find_dependency(Freetype)
|
|
|
|
+ set(FreeType_LIB Freetype::Freetype)
|
|
|
|
sfml_bind_dependency(TARGET Freetype FRIENDLY_NAME "FreeType" SEARCH_NAMES "freetype")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt
|
2023-06-24 04:23:10 +08:00
|
|
|
index a939a988..259835f7 100644
|
2022-08-05 10:18:37 +08:00
|
|
|
--- a/src/SFML/Graphics/CMakeLists.txt
|
|
|
|
+++ b/src/SFML/Graphics/CMakeLists.txt
|
2023-06-24 04:23:10 +08:00
|
|
|
@@ -93,7 +93,8 @@ sfml_add_library(sfml-graphics
|
2022-08-05 10:18:37 +08:00
|
|
|
target_link_libraries(sfml-graphics PUBLIC sfml-window)
|
|
|
|
|
|
|
|
# stb_image sources
|
2023-06-24 04:23:10 +08:00
|
|
|
-target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image")
|
2022-08-05 10:18:37 +08:00
|
|
|
+find_path(STB_INCLUDE_DIR stb_image.h REQUIRED)
|
|
|
|
+target_include_directories(sfml-graphics PRIVATE "${STB_INCLUDE_DIR}")
|
|
|
|
|
2023-06-24 04:23:10 +08:00
|
|
|
# glad sources
|
|
|
|
target_include_directories(sfml-graphics SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include")
|
|
|
|
@@ -123,7 +124,8 @@ if((SFML_COMPILER_MSVC AND SFML_MSVC_VERSION GREATER_EQUAL 14) OR (SFML_COMPILER
|
|
|
|
target_link_libraries(sfml-graphics PRIVATE legacy_stdio_definitions.lib)
|
2022-08-05 10:18:37 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
-sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY")
|
|
|
|
+set(FreeType_LIB Freetype::Freetype)
|
|
|
|
+sfml_find_package(Freetype LINK FreeType_LIB)
|
|
|
|
target_link_libraries(sfml-graphics PRIVATE Freetype)
|
|
|
|
|
|
|
|
# add preprocessor symbols
|
|
|
|
diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt
|
2023-06-24 04:23:10 +08:00
|
|
|
index d2bdd5aa..2a9937f1 100644
|
2022-08-05 10:18:37 +08:00
|
|
|
--- a/src/SFML/Window/CMakeLists.txt
|
|
|
|
+++ b/src/SFML/Window/CMakeLists.txt
|
2023-06-24 04:23:10 +08:00
|
|
|
@@ -325,7 +325,9 @@ elseif(SFML_OS_ANDROID)
|
|
|
|
target_link_libraries(sfml-window PRIVATE EGL)
|
|
|
|
target_link_libraries(sfml-window PRIVATE GLES)
|
2022-08-05 10:18:37 +08:00
|
|
|
else()
|
2023-06-24 04:23:10 +08:00
|
|
|
- sfml_find_package(OpenGL INCLUDE "OPENGL_INCLUDE_DIR" LINK "OPENGL_gl_LIBRARY")
|
2022-08-05 10:18:37 +08:00
|
|
|
+ set(EXPORT_OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE}" CACHE INTERNAL "")
|
|
|
|
+ set(OpenGL_LIB OpenGL::GL)
|
|
|
|
+ sfml_find_package(OpenGL LINK OpenGL_LIB)
|
|
|
|
target_link_libraries(sfml-window PRIVATE OpenGL)
|
|
|
|
endif()
|
|
|
|
|