Don't request static libraries.
The Linux eco system is built on shared libraries, thus you'll also only get shared libraries from the package managers
I have my cmakelist like this:
cmake_minimum_required(VERSION 3.20)
project(BerryGame)
set(CMAKE_CXX_STANDARD 14)
add_executable(BerryGame main.cpp src/Level.cpp include/Level.h src/Game.cpp include/Game.h src/Platform.cpp include/Platform.h src/Item.cpp include/Item.h src/Life.cpp include/Life.h src/Coin.cpp include/Coin.h src/Collider.cpp include/Collider.h src/Enemy.cpp include/Enemy.h src/MrStrawberry.cpp include/MrStrawberry.h src/Animation.cpp include/Animation.h src/MrBerry.cpp include/MrBerry.h src/Projectile.cpp include/Projectile.h src/Sentry.cpp include/Sentry.h)
target_include_directories(BerryGame PUBLIC include)
find_package(SFML 2.4 COMPONENTS graphics window system REQUIRED)
target_link_libraries(BerryGame sfml-system sfml-window sfml-graphics sfml-audio)
And the same fatal error occurs. Funnily enough, when i use this exact cmakelist (with changed executables of course) in this examplary program:
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
It works perfectly fine.