1
General discussions / having trouble adding a SFML to my project using CMake
« on: March 06, 2024, 11:12:51 am »
My IDE is CLion, using CMake and SFML.
I've been trying to figure this but for whatever reason, my brain is acting like the smoothest sphere you've ever seen.
my project structure is:
I've been trying to figure this but for whatever reason, my brain is acting like the smoothest sphere you've ever seen.
my project structure is:
MyProject
sfml
bin
include
SFML
Audio
// various .hpp files
Graphics
// various .hpp files
Network
// various .hpp files
System
// various .hpp files
Window
// various .hpp files
lib
CMakeLists.txt
main.cpp
and i have this in my CMakeLists.txtsfml
bin
include
SFML
Audio
// various .hpp files
Graphics
// various .hpp files
Network
// various .hpp files
System
// various .hpp files
Window
// various .hpp files
lib
CMakeLists.txt
main.cpp
cmake_minimum_required(VERSION 3.26)
project(byte)
set(CMAKE_CXX_STANDARD 17)
add_executable(MyProject main.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sfml/include)
As far as i understand, the include_directories is basically bringing in the header files, but im having trouble with target_link_libraries. i've tried usingproject(byte)
set(CMAKE_CXX_STANDARD 17)
add_executable(MyProject main.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sfml/include)
target_link_libraries(MyProject ${CMAKE_CURRENT_SOURCE_DIR}/sfml/lib)
but CMake drops that item, saying it may only link to libraries. What is it that i am missing in this?