Hi
I'm on windows and im trying to setup SFML with a cmake script.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.12.1 )
project(Towdef)
add_definitions(-DDEBUG_BUILD)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(SFML_DIR "C:/Users/vatsug/SFML-2.5.1/cmake")
find_package(SFML 2.5 COMPONENTS graphics network audio window system REQUIRED)
set(sfml-libs
sfml-graphics
sfml-network
sfml-audio
sfml-window
sfml-system
)
file(GLOB SOURCES *.cpp)
add_executable(Towdef ${SOURCES})
target_link_libraries(Towdef ${sfml-libs})
When i run it i get the following error:
CMake Error at CMakeLists.txt:9 (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:/Users/vatsug/SFML-2.5.1/cmake/SFMLConfig.cmake, version: unknown
And when i remove the 2.5 from find_package i get this error:
CMake Error at CMakeLists.txt:9 (find_package):
Found package configuration file:
C:/Users/vatsug/SFML-2.5.1/cmake/SFMLConfig.cmake
but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
FOUND.
What am i doing wrong?
Thanks for reading.
EDIT:
oh and another question:
In order to get this to work in the first place i had to go in to my sfml/cmake directory and rename the SFMLConfig.cmake.in to SFMLConfig.cmake
otherwise cmake couldn't find it. Is there a reason that it has a .in postfix?