Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CMake: Could not find a configuration file for package "SFML" that is compatible  (Read 3733 times)

0 Members and 1 Guest are viewing this topic.

Grundkurs

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
I have a hard time compiling SFML on my machine.
In the past i have done the following procedure like a 1000 times without having any issues, but now i receive the following error:
Quote
CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a configuration file for package "SFML" that is compatible
  with requested version "2.5".

  The following configuration files were considered but not accepted:

    C:/Program Files (x86)/SFML/lib/cmake/SFML/SFMLConfig.cmake, version: 3.0.0



-- Configuring incomplete, errors occurred!
See also "C:/src/test/build/CMakeFiles/CMakeOutput.log".

I compiled SFML on different Windows Versions (10 and 11) and used different versions of mingw-w64 (from https://winlibs.com/), but i always get this error. I never had this issue before. The steps i did:
  • Get SFML from Github
  • Create Makefiles with CMake, using MinGW Makefiles as generator
  • run "mingw32-make install" in the CMake-Build-Folder that i need to select in CMake-GUI
I use this basic CMakeLists.txt-file to build the project:
Quote
cmake_minimum_required(VERSION 3.1)

project(SFMLTest)

## If you want to link SFML statically
# set(SFML_STATIC_LIBRARIES TRUE)

## In most cases better set in the CMake cache
# set(SFML_DIR "<sfml root prefix>/lib/cmake/SFML")

find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
add_executable(SFMLTest main.cpp)
target_link_libraries(SFMLTest sfml-graphics sfml-audio)

Here a similar error-message has been discussed: https://github.com/SFML/SFML/issues/1593
OP stated at one point "You were right. I used the wrong compiler in this project. Thank you!", however i don't think this is the reason in my case why find_package() does not work anymore.

EDIT: When i did the exact same steps described above with the SFML-Source from here:
https://www.sfml-dev.org/files/SFML-2.5.1-sources.zip
the described error does not occure.

I also double-checked this. The error can be reproduced if i use the Github Source-Code. When i use the source from https://www.sfml-dev.org/files/SFML-2.5.1-sources.zip everything is ok. 
« Last Edit: January 23, 2022, 10:25:31 am by Grundkurs »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11175
    • View Profile
    • development blog
    • Email
Welcome to a new age! :D

The SFML master branch is currently undergoing massive changes towards SFML 3 (yes, as in new major version 3). If you're not exactly interested in a bumpy rid of potentially breaking and changing things, you may want to check out the 2.6.x branch instead, which eventually will become the SFML 2.6 release. :)
Official FAQ: https://www.sfml-dev.org/faq/
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

metal_in_my_veins

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Can we expect android/ios support in SFML 3? About when is it gonna come out?

fulfowi

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
I have the same problem with 2.6.x:

$ ./cmake.bat

C:\Users\dougy\OneDrive\Attachments\Documents\BJT\src>"C:\Program Files\CMake\bin\cmake.exe" -D CMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -D CMAKE_MAKE_PROGRAM:PATH="C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/mingw32-make" -D CMAKE_CXX_COMPILER="gcc" -D CMAKE_CXX_FLAGS="-std=gnu++17"
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw32/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/mingw32/bin/gcc.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:6 (find_package):
  Could not find a configuration file for package "SFML" that is compatible
  with requested version "2.6.2".

  The following configuration files were considered but not accepted:

    C:/SFML-2.6.2/lib/cmake/SFML/SFMLConfig.cmake, version: 2.6.2 (64bit)



-- Configuring incomplete, errors occurred!

 

anything