Hello everyone!
My first time posting
Here is my problem: CMake is finding the new SFML 2.5 Cmake config file. But it doesn't let the compiler find the SFML header file.
Here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.11)
project(AgEngine VERSION 0.1 LANGUAGES CXX)
add_executable(AgEngine main.cpp Game.cpp)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
target_compile_options(AgEngine PRIVATE -Werror)
target_compile_features(AgEngine PRIVATE cxx_std_17)
# Find SFML
find_package(SFML 2.5 COMPONENTS audio graphics window system REQUIRED)
#Include SOL2 header files
include_directories(${CMAKE_SOURCE_DIR}/sol2/include)
#add_subdirectory(ECS)
target_link_libraries(AgEngine
PUBLIC
sfml-graphics sfml-audio sfml-window sfml-system )
And here is the ouput of my make command :
build make
-- Found SFML 2.5.0 in /usr/lib64/cmake/SFML
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lucb/Programming/cpp/AgEngine/build
Scanning dependencies of target AgEngine
[ 33%] Building CXX object CMakeFiles/AgEngine.dir/main.cpp.o
In file included from /home/lucb/Programming/cpp/AgEngine/main.cpp:3:
/home/lucb/Programming/cpp/AgEngine/Game.h:3:10: fatal error: SFML\Window.hpp: No such file or directory
#include <SFML\Window.hpp>
^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/AgEngine.dir/build.make:63: CMakeFiles/AgEngine.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/AgEngine.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Here is my compile_commands.json file:
[
{
"directory": "/home/lucb/Programming/cpp/AgEngine/build",
"command": "/usr/bin/c++ -I/home/lucb/Programming/cpp/AgEngine/sol2/include -Werror -std=gnu++17 -o CMakeFiles/AgEngine.dir/main.cpp.o -c /home/lucb/Programming/cpp/AgEngine/main.cpp",
"file": "/home/lucb/Programming/cpp/AgEngine/main.cpp"
},
{
"directory": "/home/lucb/Programming/cpp/AgEngine/build",
"command": "/usr/bin/c++ -I/home/lucb/Programming/cpp/AgEngine/sol2/include -Werror -std=gnu++17 -o CMakeFiles/AgEngine.dir/Game.cpp.o -c /home/lucb/Programming/cpp/AgEngine/Game.cpp",
"file": "/home/lucb/Programming/cpp/AgEngine/Game.cpp"
}
]%
I'm on Manjaro and have SFML installed with the package manager, so no fancy directories.
It looks like CMake isn't able to tell my compiler where the SFML include files are even though it did find the SFMLConfig.cmake..
Can anybody help me?
Thanks in advance.
Aganthor!