diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a974c4..8a1c6cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,34 +41,14 @@ if (IMGUI_SFML_FIND_SFML) if (NOT BUILD_SHARED_LIBS) set(SFML_STATIC_LIBRARIES ON) endif() - find_package(SFML 2.5 COMPONENTS graphics system window) + find_package(SFML COMPONENTS graphics system window) if(NOT SFML_FOUND) message(FATAL_ERROR "SFML 2 directory not found. Set SFML_DIR to directory where SFML was built (or one which ccontains SFMLConfig.cmake)") endif() endif() -# ImGui does not provide native support for CMakeLists, workaround for now to have -# users specify IMGUI_DIR. Waiting for this PR to get merged... -# https://github.com/ocornut/imgui/pull/1713 -if(NOT IMGUI_DIR) - set(IMGUI_DIR "" CACHE PATH "imgui top-level directory") - message(FATAL_ERROR "ImGui directory not found. Set IMGUI_DIR to imgui's top-level path (containing 'imgui.h' and other files).\n") -endif() - -# This uses FindImGui.cmake provided in ImGui-SFML repo for now -find_package(ImGui 1.80 REQUIRED) - -# these headers will be installed alongside ImGui-SFML -set(IMGUI_PUBLIC_HEADERS - ${IMGUI_INCLUDE_DIR}/imconfig.h - ${IMGUI_INCLUDE_DIR}/imgui.h - ${IMGUI_INCLUDE_DIR}/imgui_internal.h # not actually public, but users might need it - ${IMGUI_INCLUDE_DIR}/imstb_rectpack.h - ${IMGUI_INCLUDE_DIR}/imstb_textedit.h - ${IMGUI_INCLUDE_DIR}/imstb_truetype.h - ${IMGUI_INCLUDE_DIR}/misc/cpp/imgui_stdlib.h -) +find_package(imgui CONFIG REQUIRED) if (IMGUI_SFML_IMGUI_DEMO) list(APPEND IMGUI_SOURCES ${IMGUI_DEMO_SOURCES}) @@ -92,7 +72,7 @@ add_library(ImGui-SFML add_library(ImGui-SFML::ImGui-SFML ALIAS ImGui-SFML) target_link_libraries(ImGui-SFML - PUBLIC + imgui::imgui sfml-graphics sfml-system sfml-window