Open qustrolabe opened 1 year ago
I can confirm that this issue is still existing in CPM.cmake version v0.38.3 and v0.38.6.
It seems that this is present at least on Windows and Mac. On Linux it is working fine. The issue seems that the include directory for imgui is not properly propagated to the downstream projects. Also directly adding imgui
as a dependency does not provide the correct include path. It does not matter if the one-argument version CPMAddPackage("gh:ocornut/imgui")
is used or the longer multi-argument version
CPMAddPackage(
NAME imgui
GITHUB_REPOSITORY ocornut/imgui
GIT_TAG v1.87
)
Note, that a simple FetchContent
command works flawlessly on all systems:
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.87
)
FetchContent_GetProperties(imgui)
if (NOT imgui_POPULATED)
FetchContent_Populate(imgui)
endif ()
Here are some logs from a personal project (not a minimal example) that reproduce the same error:
All three links are from the same build. The same behavior can be observed when running it locally. This can be reproduced 100%.
Been trying to build project with CPM.cmake that uses imgui-sfml.
I took example from github.com/cpm-cmake/CPM.cmake/wiki/More-Snippets#SFML-IMGUI
Simple CMakeLists.txt file without any projects just simply adding packages as in example:
Also tried changing
eliasdaler/imgui-sfml
toSFML/imgui-sfml
as repo probably been transferedAnd trying to build project with Visual Studio (default generator) I get
[build] C:\path_to_project_folder\build\_deps\imgui-sfml-src\imgui-SFML.cpp(2,10): fatal error C1083: Cannot open include file: 'imgui.h': No such file or directory
So either I did something wrong or example broken and misses some parameters for imgui-sfml to get include path to imgui (and also probably some paths for SFML too).
I tried building that imgui-sfml with another recommended (in that repo's README.md) way with FetchContent and didn't have any problems. So this example is, probably, broken and should be fixed or removed. Also I remember using this exact CPM.cmake code few years ago and it worked successfully, but now I think that it worked because I had ImGui and SFML installed not only through CPM.cmake but also somewhere on my system so that complier could find them anyway even failing with CPM.