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

Author Topic: Missing dependencies - CMake, CLion  (Read 3071 times)

0 Members and 1 Guest are viewing this topic.

Whatever

  • Newbie
  • *
  • Posts: 1
    • View Profile
Missing dependencies - CMake, CLion
« on: May 11, 2018, 11:58:42 pm »
Hello,
I downloaded 2.5 SFML sources from git, did some configurations with CMake (checked SFML_USE_STATIC_STD_LIBS, unchecked the shared libraries options, specified install prefix) and compiled generated folder using MinGW x86_64-7.3.0-posix-seh (recommended compiler, "mingw32-make install"). Generally, I followed sollution from this topic https://en.sfml-dev.org/forums/index.php?topic=21161.0 (scroll down to the bottom of the page) and got the following output:

CMake Error at cmake_modules/FindSFML.cmake:355 (message):
  SFML found but some of its dependencies are missing ( libjpeg)

CLion is set to use the same compiler. You will find my CMakeLists.txt and FindSFML.cmake attached. Could you please help me get it working?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Missing dependencies - CMake, CLion
« Reply #1 on: May 12, 2018, 01:08:02 am »
FindSFML.cmake is no longer supported, instead you get to use SFMLConfig.cmake which is even simpler to use. If SFML isn't in the standard library path, you can simply set SFML_DIR to the directory where the SFMLConfig.cmake is located and then you do find_package and target_link_libraries. You'll find a minimal example below.

libjpeg is no longer a dependency of SFML, but since you use the old FindSFML.cmake it still thinks it is.

cmake_minimum_required(VERSION 3.1)

project(SFMLTest)

set(SFML_DIR "<sfml root prefix>/lib/cmake/SFML")
find_package(SFML 2.5 COMPONENTS graphics)
add_executable(SFMLTest main.cpp)
target_link_libraries(SFMLTest sfml-graphics)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/