I'm quite new to CMake and C++ in general, so today I've tried to import an external library like SFML to my project in Jetbrain's IDE CLion, but without any luck.
After spending a whole day learning about CMake in general and making SFML work with CMake in particular, I've finally managed my project's CMake to find the SFML library files.
However, when I approached a header file of my own to include a SFML header, I encountered a problem as it didn't find any headers from the library - And by that I mean the #include directives.
Since I am a newbie, I'm quite lost here.
Here's my CMakeLists.txt file:
# Set CMake's minimum required version
cmake_minimum_required(VERSION 3.5)
set(CMAKE_VERBOSE_MAKEFILE on)
#Set CMake's project name
project(testproj)
include_directories("${PROJECT_BINARY_DIR}")
#Set CMake's flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#Set source files
set(SOURCE_FILES Animal.cpp Animal.hpp ConstantValues.hpp Enums.hpp Mamal.hpp Mammals/Lion.cpp Mammals/Lion.hpp)
add_library(testproj SHARED ${SOURCE_FILES})
#Set CMake's module path to find the SFML Lib
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Modules/" ${CMAKE_MODULE_PATH})
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\SFML\\SFML-2.3.2")
#Find the SFML lib
find_package(SFML 2 REQUIRED audio)
if (SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(testproj ${SFML_LIBRARIES})
endif (SFML_FOUND)
It is worth noting that I'm working on Windows and I look only for the audio module in SFML.
What am I missing?