“Could NOT find SFML” error in CLion/CMake on Windows 10?











up vote
0
down vote

favorite












I'm currently trying to integrate SFML into CLion on Windows 10 (I'm not very familiar with SFML or CMake). I've tried a few different things and combinations in my CMakeLists.txt, but I keep getting the same error:



CMake Error at cmake_modules/FindSFML.cmake:199 (message):              
Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY)
Call Stack (most recent call first):
CMakeLists.txt:12 (find_package)


This is my CMakeLists.txt:



cmake_minimum_required(VERSION 3.10)
project(P3)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(P3 ${SOURCE_FILES})

set(SFML_ROOT "C:/SFML-2.5.1")

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
find_package(SFML REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
link_directories("C:/SFML-2.5.1")
target_link_libraries(P3 ${SFML_LIBRARIES})
endif()


I'm not really sure what I'm doing wrong here. I've been at it for a fairly long while and despite countless Google searches and research, I can't seem to find a solution. Any help would be greatly appreciated and thank you in advance.



Also, my FindSFML.cmake file is located in a cmake_modules folder that I created within my project folder that is within my CLionProjects folder if that's useful information.










share|improve this question


























    up vote
    0
    down vote

    favorite












    I'm currently trying to integrate SFML into CLion on Windows 10 (I'm not very familiar with SFML or CMake). I've tried a few different things and combinations in my CMakeLists.txt, but I keep getting the same error:



    CMake Error at cmake_modules/FindSFML.cmake:199 (message):              
    Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
    SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY)
    Call Stack (most recent call first):
    CMakeLists.txt:12 (find_package)


    This is my CMakeLists.txt:



    cmake_minimum_required(VERSION 3.10)
    project(P3)

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

    set(SOURCE_FILES main.cpp)
    add_executable(P3 ${SOURCE_FILES})

    set(SFML_ROOT "C:/SFML-2.5.1")

    set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
    find_package(SFML REQUIRED system window graphics network audio)
    if(SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    link_directories("C:/SFML-2.5.1")
    target_link_libraries(P3 ${SFML_LIBRARIES})
    endif()


    I'm not really sure what I'm doing wrong here. I've been at it for a fairly long while and despite countless Google searches and research, I can't seem to find a solution. Any help would be greatly appreciated and thank you in advance.



    Also, my FindSFML.cmake file is located in a cmake_modules folder that I created within my project folder that is within my CLionProjects folder if that's useful information.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm currently trying to integrate SFML into CLion on Windows 10 (I'm not very familiar with SFML or CMake). I've tried a few different things and combinations in my CMakeLists.txt, but I keep getting the same error:



      CMake Error at cmake_modules/FindSFML.cmake:199 (message):              
      Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
      SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY)
      Call Stack (most recent call first):
      CMakeLists.txt:12 (find_package)


      This is my CMakeLists.txt:



      cmake_minimum_required(VERSION 3.10)
      project(P3)

      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

      set(SOURCE_FILES main.cpp)
      add_executable(P3 ${SOURCE_FILES})

      set(SFML_ROOT "C:/SFML-2.5.1")

      set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
      find_package(SFML REQUIRED system window graphics network audio)
      if(SFML_FOUND)
      include_directories(${SFML_INCLUDE_DIR})
      link_directories("C:/SFML-2.5.1")
      target_link_libraries(P3 ${SFML_LIBRARIES})
      endif()


      I'm not really sure what I'm doing wrong here. I've been at it for a fairly long while and despite countless Google searches and research, I can't seem to find a solution. Any help would be greatly appreciated and thank you in advance.



      Also, my FindSFML.cmake file is located in a cmake_modules folder that I created within my project folder that is within my CLionProjects folder if that's useful information.










      share|improve this question













      I'm currently trying to integrate SFML into CLion on Windows 10 (I'm not very familiar with SFML or CMake). I've tried a few different things and combinations in my CMakeLists.txt, but I keep getting the same error:



      CMake Error at cmake_modules/FindSFML.cmake:199 (message):              
      Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
      SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY)
      Call Stack (most recent call first):
      CMakeLists.txt:12 (find_package)


      This is my CMakeLists.txt:



      cmake_minimum_required(VERSION 3.10)
      project(P3)

      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

      set(SOURCE_FILES main.cpp)
      add_executable(P3 ${SOURCE_FILES})

      set(SFML_ROOT "C:/SFML-2.5.1")

      set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
      find_package(SFML REQUIRED system window graphics network audio)
      if(SFML_FOUND)
      include_directories(${SFML_INCLUDE_DIR})
      link_directories("C:/SFML-2.5.1")
      target_link_libraries(P3 ${SFML_LIBRARIES})
      endif()


      I'm not really sure what I'm doing wrong here. I've been at it for a fairly long while and despite countless Google searches and research, I can't seem to find a solution. Any help would be greatly appreciated and thank you in advance.



      Also, my FindSFML.cmake file is located in a cmake_modules folder that I created within my project folder that is within my CLionProjects folder if that's useful information.







      windows c++11 cmake sfml clion






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 4:19









      99sp

      11




      11
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          It seems that cmake cannot find the SFML component.



          According to this link(https://en.sfml-dev.org/forums/index.php?topic=24070.0), you can try:

          set(SFML_DIR "C:/SFML-2.5.1")
          find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)






          share|improve this answer





















          • Would I still include 'system window network' in the find_package line?
            – 99sp
            Nov 22 at 21:43










          • It depens. If you need those components then include it.
            – Wei Guo
            Nov 23 at 1:40










          • I tried making those changes, but cmake is still failing to find the SFML components.
            – 99sp
            Nov 23 at 4:06










          • Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
            – Wei Guo
            Nov 23 at 4:23













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423845%2fcould-not-find-sfml-error-in-clion-cmake-on-windows-10%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          It seems that cmake cannot find the SFML component.



          According to this link(https://en.sfml-dev.org/forums/index.php?topic=24070.0), you can try:

          set(SFML_DIR "C:/SFML-2.5.1")
          find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)






          share|improve this answer





















          • Would I still include 'system window network' in the find_package line?
            – 99sp
            Nov 22 at 21:43










          • It depens. If you need those components then include it.
            – Wei Guo
            Nov 23 at 1:40










          • I tried making those changes, but cmake is still failing to find the SFML components.
            – 99sp
            Nov 23 at 4:06










          • Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
            – Wei Guo
            Nov 23 at 4:23

















          up vote
          0
          down vote













          It seems that cmake cannot find the SFML component.



          According to this link(https://en.sfml-dev.org/forums/index.php?topic=24070.0), you can try:

          set(SFML_DIR "C:/SFML-2.5.1")
          find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)






          share|improve this answer





















          • Would I still include 'system window network' in the find_package line?
            – 99sp
            Nov 22 at 21:43










          • It depens. If you need those components then include it.
            – Wei Guo
            Nov 23 at 1:40










          • I tried making those changes, but cmake is still failing to find the SFML components.
            – 99sp
            Nov 23 at 4:06










          • Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
            – Wei Guo
            Nov 23 at 4:23















          up vote
          0
          down vote










          up vote
          0
          down vote









          It seems that cmake cannot find the SFML component.



          According to this link(https://en.sfml-dev.org/forums/index.php?topic=24070.0), you can try:

          set(SFML_DIR "C:/SFML-2.5.1")
          find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)






          share|improve this answer












          It seems that cmake cannot find the SFML component.



          According to this link(https://en.sfml-dev.org/forums/index.php?topic=24070.0), you can try:

          set(SFML_DIR "C:/SFML-2.5.1")
          find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 at 6:56









          Wei Guo

          381212




          381212












          • Would I still include 'system window network' in the find_package line?
            – 99sp
            Nov 22 at 21:43










          • It depens. If you need those components then include it.
            – Wei Guo
            Nov 23 at 1:40










          • I tried making those changes, but cmake is still failing to find the SFML components.
            – 99sp
            Nov 23 at 4:06










          • Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
            – Wei Guo
            Nov 23 at 4:23




















          • Would I still include 'system window network' in the find_package line?
            – 99sp
            Nov 22 at 21:43










          • It depens. If you need those components then include it.
            – Wei Guo
            Nov 23 at 1:40










          • I tried making those changes, but cmake is still failing to find the SFML components.
            – 99sp
            Nov 23 at 4:06










          • Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
            – Wei Guo
            Nov 23 at 4:23


















          Would I still include 'system window network' in the find_package line?
          – 99sp
          Nov 22 at 21:43




          Would I still include 'system window network' in the find_package line?
          – 99sp
          Nov 22 at 21:43












          It depens. If you need those components then include it.
          – Wei Guo
          Nov 23 at 1:40




          It depens. If you need those components then include it.
          – Wei Guo
          Nov 23 at 1:40












          I tried making those changes, but cmake is still failing to find the SFML components.
          – 99sp
          Nov 23 at 4:06




          I tried making those changes, but cmake is still failing to find the SFML components.
          – 99sp
          Nov 23 at 4:06












          Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
          – Wei Guo
          Nov 23 at 4:23






          Maybe you can replace FindSFML.cmake with the latest SFMLConfig.cmake file. As the post link points out.
          – Wei Guo
          Nov 23 at 4:23




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423845%2fcould-not-find-sfml-error-in-clion-cmake-on-windows-10%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)