CPM.cmake
CPM.cmake copied to clipboard
Help adding ImGui using CPM
Hello, I have tried using cpm to add the ImGui module to my c++ project.
Different methods I've tried.
CPMAddPackage(
NAME imgui
GITHUB_REPOSITORY ocornut/imgui
GIT_TAG v1.88
)
CPMAddPackage(
NAME imgui
GITHUB_REPOSITORY ocornut/imgui
VERSION 1.88
)
CPMAddPackage("https://github.com/ocornut/imgui/archive/refs/tags/v1.88.zip")
Thanks for any support you can give me :)
Correct me if I'm wrong, but I'm pretty sure ImGui does not come with any project file using any build system whatsoever. Given that, you'll likely have to create the targets yourself or add the sources to an existing one using the variable imgui_SOURCE_DIR that points to where CPM cloned it.
I use this:
CPMAddPackage(gh:ocornut/[email protected])
add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp # optionally comment this out
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
)
target_include_directories(imgui INTERFACE ${imgui_SOURCE_DIR})
target_compile_definitions(imgui PUBLIC -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS) # optional imgui setting
set_target_properties(imgui PROPERTIES FOLDER third-party) # optoinal IDE dir