Skip to content

Commit fbb5eb3

Browse files
committed
Improve the error output when SFML couldn't be found, to inform users about the weird failure when setting SFML_DIR to the build directory (to prevent more reports like issue #251)
1 parent e86fce2 commit fbb5eb3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmake/Dependencies.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ macro(tgui_find_dependency_sfml component optional_quiet)
6464
message(NOTICE "\nSearching for SFML 2...\n")
6565
find_package(SFML 2 CONFIG COMPONENTS ${lowercase_component})
6666

67+
set(SFML_DIR ${sfml_dir_original})
6768
message(NOTICE "\nSearching for SFML 3...\n")
6869
find_package(SFML 3 CONFIG COMPONENTS ${component})
6970
endif()
@@ -77,9 +78,11 @@ macro(tgui_find_dependency_sfml component optional_quiet)
7778
# find_package couldn't find SFML
7879
if(NOT SFML_FOUND)
7980
set(SFML_DIR "" CACHE PATH "Path to SFMLConfig.cmake")
81+
message(STATUS "")
8082
message(FATAL_ERROR
8183
"CMake couldn't find SFML.\n"
82-
"Set SFML_DIR to the directory containing SFMLConfig.cmake (usually something like SFML_ROOT/lib/cmake/SFML)\n")
84+
"Set SFML_DIR to the directory containing SFMLConfig.cmake (usually SFML_ROOT/lib/cmake/SFML).\n"
85+
"If searching for SFML 2 found an SFML 3 config, but searching for SFML 3 failed to find it's Shared/Static configuration, then you are probably attempting to import SFML from its build directory. This is no longer supported in SFML 3, you must install SFML.\n")
8386
endif()
8487

8588
if (SFML_VERSION VERSION_LESS "2.5.0")

0 commit comments

Comments
 (0)