diff --git a/CMakeLists.txt b/CMakeLists.txt index 247672c..12aa11a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,19 +7,10 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF) include(FetchContent) FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML.git - GIT_TAG 2.6.x) + GIT_TAG master) FetchContent_MakeAvailable(SFML) add_executable(main src/main.cpp) -target_link_libraries(main PRIVATE sfml-graphics) -target_compile_features(main PRIVATE cxx_std_17) - -if(WIN32) - add_custom_command( - TARGET main - COMMENT "Copy OpenAL DLL" - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${SFML_SOURCE_DIR}/extlibs/bin/$,x64,x86>/openal32.dll $ - VERBATIM) -endif() +target_link_libraries(main PRIVATE SFML::Graphics) install(TARGETS main) diff --git a/src/main.cpp b/src/main.cpp index cb00d46..d1a9748 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,14 +2,14 @@ int main() { - auto window = sf::RenderWindow{ { 1920u, 1080u }, "CMake SFML Project" }; + auto window = sf::RenderWindow{ sf::VideoMode{ { 1920u, 1080u } }, "CMake SFML Project" }; window.setFramerateLimit(144); while (window.isOpen()) { - for (auto event = sf::Event{}; window.pollEvent(event);) + while (const auto event = window.pollEvent()) { - if (event.type == sf::Event::Closed) + if (event.is()) { window.close(); }