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

Add simple cmake #4614

Closed
wants to merge 3 commits into from
Closed

Add simple cmake #4614

wants to merge 3 commits into from

Conversation

yh-sb
Copy link

@yh-sb yh-sb commented Oct 2, 2021

I have looked into pull requests which add cmake to imgui project. Trying to cover both, imgui backends and examples, they just stuck in review state.

Let's go another way: add simple cmake for imgui itself.
I tried to create a simple and easy to use CMakeLists.txt.

Here is how imgui integration will look into some project:

set(IMGUI_BACKEND_GLFW ON CACHE BOOL "")
set(IMGUI_BACKEND_OPENGL3 ON CACHE BOOL "")
add_subdirectory(third_party/imgui)
...
target_link_libraries(some_project_name PRIVATE imgui)

Tested on Windows and Linux.

@ocornut, if you are not ok with keeping cmake file in imgui root, then we can move it to /cmake directory.

@TerensTare
Copy link

TerensTare commented Dec 16, 2021

The vcpkg port of ImGui uses CMake for building and also includes support for backends. Maybe it is worth just adapting the "recipe" from there, given there will be little to no change needed? Also remember vcpkg is widely used so the cmake "recipe" is already tested on different environments.

@AdelKS
Copy link

AdelKS commented Dec 17, 2021

I am probably doing something wrong, I dropped this CMakeLists.txt file at the root of the project and cmake gives me this:

   ninja: error: build.ninja:143: bad $-escape (literal $ must be written as $$)
    LINK_LIBRARIES = $<0:d3d10.lib  -ld3dcompiler.lib>  $<0:d3d11.lib  -ld...
                     ^ near here

@yh-sb
Copy link
Author

yh-sb commented Dec 23, 2021

@AdelKS, If I understand you correctly, it seems that you placed this CMakeLists.txt to the root of your top-level project. But it is intended to be in the root of imgui library, not in root of top-level project.
After that, in top-level CMakeLists.txt paste the code from the first comment in this pull request.

@yh-sb
Copy link
Author

yh-sb commented Apr 6, 2024

Hi @ocornut ,
Any reason to not add this feature? If so, I will close this PR.

@ocornut
Copy link
Owner

ocornut commented Apr 6, 2024

I prefer to keep them open as useful reference but haven’t had time to wade through the million of cmake suggestions.

@yh-sb yh-sb closed this by deleting the head repository Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants