diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a974c4..8a1c6cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,37 +38,14 @@ set(IMGUI_SFML_CONFIG_INSTALL_DIR "" CACHE PATH "Path where user's config header list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") 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}) @@ -93,6 +70,7 @@ add_library(ImGui-SFML target_link_libraries(ImGui-SFML PUBLIC + imgui::imgui sfml-graphics sfml-system sfml-window