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 - Aganthor

Pages: [1]
1
General / Re: SFML with CMake help!
« on: September 08, 2018, 12:40:57 pm »
Oh my god!

The problem was so obvious that it evaded me. Thank you so much  8)

Aganthor!

Use forward slashes in your code, i.e. <SFML/Window.hpp>. While Windows may be able to deal with backslashes, Linux like environments don't. Since Windows can also deal with forward slashes, there's essentially no point in every using backslashes. ;)

2
General / SFML with CMake help!
« on: September 08, 2018, 03:57:42 am »
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!


Pages: [1]
anything