Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: can't set(SFML_STATIC_LIBRARIES TRUE) in cmake SFML 2.5.1 on Debian 10  (Read 4475 times)

0 Members and 1 Guest are viewing this topic.

otherMonkey

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
I already asked in Stack Overflow, but there nobody can help me yet.
https://stackoverflow.com/questions/59555700/setsfml-static-libraries-true-doesnt-work-in-cmake-with-sfml-2-5-1-on-debian


I installed SFML with the command "apt install libsfml-dev".

I can link it in cmake discribed like in this post https://en.sfml-dev.org/forums/index.php?topic=24070.0 and everything works pretty fine.

But if I add set(SFML_STATIC_LIBRARIES TRUE) to my cmake file to link sfml static I get the following error:

Quote
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/SFML/SFMLConfig.cmake:139 (message):
  Requested SFML configuration (Static) was not found
Call Stack (most recent call first):
  CMakeLists.txt:30 (find_package)

CMake Error at CMakeLists.txt:30 (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.

I recognized that the SFMLConfig.cmake (https://github.com/SFML/SFML/blob/master/cmake/SFMLConfig.cmake.in) file wants to access a SFMLStaticTargets.cmake file in line 110, if I set(SFML_STATIC_LIBRARIES TRUE).

But my /usr/lib/x86_64-linux-gnu/cmake/SFML folder just contains the following files for Shared linking:

    SFMLConfig.cmake
    SFMLConfigDependencies.cmake
    SFMLConfigVersion.cmake
    SFMLSharedTargets.cmake
    SFMLSharedTargets-none.cmake

In sfml version I can download here "https://www.sfml-dev.org/download/sfml/2.5.1/" I can also just find these files in the lib/cmake/SFML folder, but a SFMLSharedTargets-release.cmake file instead of SFMLSharedTargets-none.cmake.

What can I do to static link sfml 2.5.1 in cmake on my system?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: can't set(SFML_STATIC_LIBRARIES TRUE) in cmake SFML 2.5.1 on Debian 10
« Reply #1 on: January 06, 2020, 01:38:59 pm »
You have to recompile SFML, because pre-built packages for Linux don't contain static libraries.
Laurent Gomila - SFML developer

otherMonkey

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: can't set(SFML_STATIC_LIBRARIES TRUE) in cmake SFML 2.5.1 on Debian 10
« Reply #2 on: January 06, 2020, 01:42:43 pm »
Thank you for the fast answer! I will try this. :)

filip

  • Newbie
  • *
  • Posts: 1
    • View Profile
How do you do this?


 

anything