Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified CMake to match the comportment of the system installed library #1

Open
wants to merge 1 commit into
base: release_1_88
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
# TODO: add better synthax for library
add_library(imgui STATIC
cmake_minimum_required(VERSION 3.1)
project(imgui)

add_library(imgui
imgui.cpp
imgui_draw.cpp
imgui_demo.cpp
imgui_widgets.cpp
imgui_tables.cpp

imgui_impl_glfw.cpp
imgui_impl_opengl3.cpp
)
backends/imgui_impl_glfw.cpp
backends/imgui_impl_opengl3.cpp
)
file(GLOB _headers *.h backends/*.h)

target_source(imgui PUBLIC
FILE_SET HEADERS
FILES ${_headers}
)

find_package(glfw3 REQUIRED)

if(NOT DEFINED(OpenGL_GL_PREFERENCE))
set(OpenGL_GL_PREFERENCE LEGACY)
endif()
find_package(OpenGL REQUIRED)

target_link_libraries(imgui PRIVATE OpenGL::GL glfw)
target_include_directories(imgui
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/backends>
)

add_library(imgui::imgui ALIAS imgui)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.