CMake can not find SFML lib

Viewed 21

I have a project depends on SFML lib on C++. I trying to make it with CMake. CMakeLists.txt is:

cmake_minimum_required(VERSION 3.16.3)
project(3D_Renderer_from_scratch)

set(CMAKE_CXX_STANDARD 17)

include_directories(headers source)

set(SFML_STATIC_LIBRARIES TRUE)

find_package(SFML COMPONENTS window graphics system)

set(SOURCES
        Main.cpp
        source/Application.cpp
        source/Box.cpp
        source/Camera.cpp
        source/FileReader.cpp
        source/KeyboardHandler.cpp
        source/Sphere.cpp
        source/Triangle.cpp
        source/Window.cpp
        source/World.cpp
        )

add_executable(executable ${SOURCES})

target_link_libraries(executable ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})

After running cmake . I have the following error:

$ cmake .
-- Requested SFML configuration (Static) was not found
CMake Warning at CMakeLists.txt:10 (find_package):
  Found package configuration file:

    /usr/lib/x86_64-linux-gnu/cmake/SFML/SFMLConfig.cmake

  but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
  FOUND.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/mcjohn974/3D_Renderer_from_scratch

How can I fix it ? (sfml lib is already installed)

0 Answers
Related