From 30a986e63261eea3ae90e5d16b5b894f2f712403 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 16 Jan 2024 13:10:58 -0700 Subject: [PATCH] Use CMake-standard _ROOT variable to locating config module https://cmake.org/cmake/help/v3.22/command/find_package.html https://cmake.org/cmake/help/v3.22/variable/PackageName_ROOT.html#variable:%3CPackageName%3E_ROOT SFML_DIR predates the existence of _ROOT which is now the preferred way to specify where to find a given package's config module. User reports have shown that SFML_DIR may be broken at least in certain circumstances so lets stop mentioning it. --- cmake/SFMLConfig.cmake.in | 6 +++--- examples/android/app/src/main/jni/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/SFMLConfig.cmake.in b/cmake/SFMLConfig.cmake.in index 2e568cd69..7c35a05ac 100644 --- a/cmake/SFMLConfig.cmake.in +++ b/cmake/SFMLConfig.cmake.in @@ -41,7 +41,7 @@ # Additionally, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which # are available for both release and debug modes. # -# If SFML is not installed in a standard path, you can use the SFML_DIR CMake variable +# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake variable # to tell CMake where SFML's config file is located (PREFIX/lib/cmake/SFML for a library-based installation, # and PREFIX/SFML.framework/Resources/CMake on macOS for a framework-based installation). # @@ -109,7 +109,7 @@ list(REMOVE_DUPLICATES SFML_FIND_COMPONENTS) if(SFML_STATIC_LIBRARIES) set(SFML_IS_FRAMEWORK_INSTALL "@SFML_BUILD_FRAMEWORKS@") if(SFML_IS_FRAMEWORK_INSTALL) - message(WARNING "Static frameworks are not supported by SFML. Clear SFML_DIR cache entry, \ + message(WARNING "Static frameworks are not supported by SFML. Clear SFML_ROOT cache entry, \ and either change SFML_STATIC_LIBRARIES or CMAKE_FIND_FRAMEWORK before calling find_package(SFML)") endif() set(config_name "Static") @@ -134,7 +134,7 @@ if(EXISTS "${targets_config_file}") if(TARGET SFML::${component}) set(SFML_${UPPER_COMPONENT}_FOUND TRUE) elseif(SFML_FIND_REQUIRED_${component}) - set(FIND_SFML_ERROR "Found SFML but requested component '${component}' is missing in the config defined in ${SFML_DIR}.") + set(FIND_SFML_ERROR "Found SFML but requested component '${component}' is missing in the config defined in ${SFML_ROOT}.") set(SFML_FOUND FALSE) endif() endforeach() diff --git a/examples/android/app/src/main/jni/CMakeLists.txt b/examples/android/app/src/main/jni/CMakeLists.txt index ceae0c9cc..83739376f 100644 --- a/examples/android/app/src/main/jni/CMakeLists.txt +++ b/examples/android/app/src/main/jni/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.22) project(sfml-example CXX) -set(SFML_DIR "${CMAKE_ANDROID_NDK}/sources/third_party/sfml/lib/${CMAKE_ANDROID_ARCH_ABI}/cmake/SFML") +set(SFML_ROOT "${CMAKE_ANDROID_NDK}/sources/third_party/sfml/lib/${CMAKE_ANDROID_ARCH_ABI}/cmake/SFML") # Create the libsfml-example.so library that contains the application's c++ code add_library(sfml-example SHARED main.cpp)