vcpkg/ports/imgui-sfml/0001-fix_find_package.patch

51 lines
1.8 KiB
Diff
Raw Normal View History

2019-09-10 22:52:21 +02:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53500fd..cb98701 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,34 +35,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.68 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)
# CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL just because it's safer
# (unless the OpenGL_GL_PREFERENCE was explicitly set)
@@ -82,7 +62,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