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

Author Topic: Clion sfml Cmake error  (Read 968 times)

0 Members and 1 Guest are viewing this topic.

YigitHamza

  • Newbie
  • *
  • Posts: 3
    • View Profile
Clion sfml Cmake error
« on: December 28, 2023, 03:39:27 pm »
i have an error setting up sfml on clion i have posted this before and eXpl0it3r 
told me to follow this tutorial here  is  the link https://edw.is/using-cmake/ i follow it and setup the sfml but
thre is a lot of errors here is the errors
====================[ Build | sogfremnmel | Debug ]=============================
"D:\JetBrains\CLion 2023.3.2\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\yigit\Desktop\projelerim\sogfremnmel\cmake-build-debug --target sogfremnmel -j 18
[0/1] Re-running CMake...
-- Found OpenGL: opengl32  found components: OpenGL
-- Fetching SFML...
CMake Deprecation Warning at cmake-build-debug/_deps/sfml-src/CMakeLists.txt:5 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:46 (add_library):
  add_library cannot create target "sfml-system" because another target with
  the same name already exists.  The existing target is a shared library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/System".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/System/CMakeLists.txt:89 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/System/CMakeLists.txt:99 (target_link_libraries):
  Attempt to add link library "winmm" to target "sfml-system" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:44 (add_library):
  add_library cannot create target "sfml-main" because another target with
  the same name already exists.  The existing target is a static library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/Main".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/Main/CMakeLists.txt:17 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:46 (add_library):
  add_library cannot create target "sfml-window" because another target with
  the same name already exists.  The existing target is a shared library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/Window".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:228 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:230 (target_link_libraries):
  Attempt to add link library "sfml-system" to target "sfml-window" which is
  not built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:258 (target_link_libraries):
  Attempt to add link library "OpenGL" to target "sfml-window" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Window/CMakeLists.txt:279 (target_link_libraries):
  Attempt to add link library "winmm" to target "sfml-window" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/cmake/Macros.cmake:46 (add_library):
  add_library cannot create target "sfml-graphics" because another target
  with the same name already exists.  The existing target is a shared library
  created in source directory
  "C:/Users/yigit/Desktop/projelerim/sogfremnmel/third_party/SFML/src/SFML/Graphics".
  See documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:93 (sfml_add_library)


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:97 (target_link_libraries):
  Attempt to add link library "sfml-window" to target "sfml-graphics" which
  is not built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:125 (target_link_libraries):
  Attempt to add link library "OpenGL" to target "sfml-graphics" which is not
  built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


-- Found OpenGL: opengl32  
CMake Error at cmake-build-debug/_deps/sfml-src/src/SFML/Graphics/CMakeLists.txt:138 (target_link_libraries):
  Attempt to add link library "Freetype" to target "sfml-graphics" which is
  not built in this directory.

  This is allowed only when policy CMP0079 is set to NEW.


-- Configuring incomplete, errors occurred!
ninja: error: rebuilding &#39;build.ninja&#39;: subcommand failed
FAILED: build.ninja
maybe i did not do something i dont know i did what the tutorial says
thans for the help

YigitHamza

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Clion sfml Cmake error
« Reply #1 on: December 30, 2023, 08:56:49 am »
now i tried with a another project because maybe the project broken and the project was not broken iy gived the same errors

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Clion sfml Cmake error
« Reply #2 on: December 30, 2023, 01:33:13 pm »
The linked resource downloads and build SFML already, as such you don't need to additionally build SFML in your third_party/SFML folder. Remove that directory and the contents, then you shouldn't run into duplicated symbols.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/