SFML community forums

Help => General => Topic started by: Eskarina on August 14, 2019, 08:52:01 am

Title: Problems making project with CMake
Post by: Eskarina on August 14, 2019, 08:52:01 am
Hello,

I'm new to SFML and trying to create a test project to figure out how it runs. I'm running Windows 7 and using CMake to build. I tried following the first window module tutorial, but the makefile that CMake generated hasn't worked, so I gave up on the tutorial and decided to try to get the makefile itself to work.

Here's the error that I get:
mingw32-make[2]: *** No rule to make target C:/Users/{USER}/Desktop/code/c++/sfmltest/SFML-build/lib/libsfml-graphics.a', needed by 'SFMLTest.exe'.  Stop.
mingw32-make[1]: *** [CMakeFiles\Makefile2:75: CMakeFiles/SFMLTest.dir/all] Error 2
mingw32-make: *** [Makefile:83: all] Error 2

And the CMakeLists.txt I was using:
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-build")

find_package(SFML 2.5.1 COMPONENTS graphics)
add_executable(SFMLTest main.cpp)
target_link_libraries(SFMLTest sfml-graphics)
(copied from https://en.sfml-dev.org/forums/index.php?topic=24070.0)

The contents of main.cpp are irrelevant, since the error happens before it's compiled.
Title: Re: Problems making project with CMake
Post by: Eskarina on August 14, 2019, 09:18:01 am
Resolved with eXpl0it3r's help; turned out I missed the step of building SFML before generating the project.