cpm-cmake / CPM.cmake

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

imgui-sfml example doesn't build

qustrolabe opened this issue · comments

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:

cmake_minimum_required(VERSION 3.20.0)

include(cmake/CPM.cmake)
CPMAddPackage("gh:ocornut/imgui#docking")
CPMAddPackage("gh:SFML/SFML#2.5.1")

CPMAddPackage(
    GITHUB_REPOSITORY "SFML/imgui-sfml"
    VERSION "2.3"
    OPTIONS "IMGUI_DIR ${imgui_SOURCE_DIR}"
)
add_compile_definitions(IMGUI_DISABLE_DEMO_WINDOWS)

Also tried changing eliasdaler/imgui-sfml to SFML/imgui-sfml as repo probably been transfered

And 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.