configure SFML for clion (windows)

前端 未结 3 526
-上瘾入骨i
-上瘾入骨i 2021-01-03 09:31

i am setting up a work environment for a school project on my windows computer. We are going to make a basic game using c++ and CLion. To make a game i need to use the SFML

相关标签:
3条回答
  • 2021-01-03 10:14

    I believe you are missing the link_directories() call. You can use it like this:

    link_directories("C:/Path_To_Library")
    

    This should help solve your issue.

    0 讨论(0)
  • 2021-01-03 10:16

    I have successfully configured SFML with CLion on Ubuntu 16.04 and I think it will be same for Window user also.

    My project name is SFML_TEST so change every occurrence of SFML_TEST with your project name.

    1. Create a new Clion C++ Project.
    2. Navigate to /path/to/CLionProjects/[Project_Name]/CMakeLists.txt
    3. After the following statement

      add_executable(SFML_TEST ${SOURCE_FILES})
      

      Add following lines of code

      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})
      target_link_libraries(SFML_TEST ${SFML_LIBRARIES})
      endif()
      
    4. Create a new directory /path/to/CLionProjects/[project_name]/cmake_modules/FindSFML.cmake

    5. In FindSFML.cmake file paste the following line of code from the given file https://github.com/SFML/SFML/blob/master/cmake/Modules/FindSFML.cmake
    6. Done!!!.. Happy Coding
    0 讨论(0)
  • 2021-01-03 10:26

    my fix was, that I had to change the root path of SFML in the FindSFML.cmake

    so just set(SFML_ROOT Z://your_project) after the block of comments and you are ready to go

    0 讨论(0)
提交回复
热议问题