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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - 123099

Pages: [1]
1
General / Re: How to add SFML 2.5 as a git submodule into CMakeLists
« on: April 21, 2020, 12:06:22 pm »
Wow, I cannot believe it was that silly a mistake!
I got confused after looking at all the different tutorials that do use find_package, and didn't realise that that is for already compiled libraries. Thank you so much, it is working now!

2
General / Re: SFML 2.5 CMake Migration
« on: April 21, 2020, 01:23:17 am »
If I am not mistaken, there is no required order for them. Simply list whatever it is you need.

3
General / How to add SFML 2.5 as a git submodule into CMakeLists
« on: April 20, 2020, 10:12:16 pm »
Hello,

I am using CLion on Windows 10 and am trying to create a project that depends on SFML 2.5.
CLion uses CMake and I want to setup my CMakeLists to automatically include SFML as a subdirectory, compile it, find the library and link it.
This is my current CMakeLists:
Code: [Select]
cmake_minimum_required(VERSION 3.16)
project(Renderer)

set(CMAKE_CXX_STANDARD 20)

add_library(${PROJECT_NAME})

add_subdirectory(src)

target_include_directories(${PROJECT_NAME} PUBLIC include)

add_subdirectory(lib/glm)
target_link_libraries(${PROJECT_NAME} PRIVATE glm)

add_definitions(-DGLEW_STATIC)
add_subdirectory(lib/glew)
target_link_libraries(${PROJECT_NAME} PRIVATE libglew_static)

# SFML
add_subdirectory(lib/SFML)

set(SFML_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/SFML)

find_package(SFML 2.5 COMPONENTS window audio REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-window sfml-audio)

And this is my folder structure. SFML is a git submodule.


The error I keep getting is
Code: [Select]
CMake Error at cmake-build-debug/lib/SFML/SFMLConfig.cmake:139 (message):
  Requested SFML configuration (Shared) was not found
Call Stack (most recent call first):
  CMakeLists.txt:23 (find_package)


CMake Error at CMakeLists.txt:23 (find_package):
  Found package configuration file:

    D:/Projects/C++/Renderer/cmake-build-debug/lib/SFML/SFMLConfig.cmake

  but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
  FOUND.

It seems like the SFML library files are not being built, even though it is included as a subdirectory?

I am not a CMake expert and have no idea how to continue forward from here. Unfortunately all the tutorials online focus on older versions of SFML and use the FindSFML thing instead of the new find_package SFMLConfig way.

Any help is appreciated!

Pages: [1]
anything