SFML community forums

Help => General => Topic started by: Zeus-Ammon on March 14, 2020, 05:29:22 pm

Title: SFML CMake Windows
Post by: Zeus-Ammon on March 14, 2020, 05:29:22 pm
Hi,

Im using SFML as a base to build another library on top. Until now I have been working on Linux with cmake (SFML from repositories) and i've been able to build my library with this simple CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(my-lib)

find_library(SYS sfml-system)
find_library(GRAPHICS sfml-graphics)
find_library(WINDOW sfml-window)

add_library(
    my-lib
    SHARED
    source files .....
)

target_include_directories(my-lib PUBLIC ${PROJECT_SOURCE_DIR})
target_link_libraries(my-lib "${SYS}" "${GRAPHICS}" "${WINDOW}")
 

This generates my-lib.so which is exactly what I need to use elsewhere.

On Windows "find_library()" does not seem to find the libraries even after I have compiled SFML from source with nmake and running nmake install which installed SFML on Program Files.

Any help would be immensly appreciated.
Title: Re: SFML CMake Windows
Post by: Laurent on March 15, 2020, 09:23:50 am
That's not how you're supposed to find SFML. Please read this: https://en.sfml-dev.org/forums/index.php?topic=24070.0