Skip to content

CMake + SFML + imgui By not providing "FindImGui-SFML.cmake" #130

@Reavolt

Description

@Reavolt

Hello, I have a CMakeList like this.

cmake_minimum_required(VERSION 3.17)
project(test VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)

# SFML
## If you want to link SFML statically
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc")
set(SFML_STATIC_LIBRARIES TRUE)

## In most cases better set in the CMake cache
set(SFML_DIR "./library/frameworks/SFML-2.5.1/lib/cmake/SFML")
set(ImGui_DIR "./library/frameworks/imgui")
set(ImGui-SFML_DIR "./library/frameworks/imgui-sfml/cmake")

add_executable(test src/main.cpp)

find_package(SFML 2.5 COMPONENTS system window graphics network audio REQUIRED)
target_link_libraries(test sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
target_include_directories(test PUBLIC ${SFML_INCLUDE_DIRS})

find_package(ImGui-SFML REQUIRED)
target_link_libraries(test PRIVATE ImGui-SFML::ImGui-SFML)
target_include_directories(test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/library/frameworks/imgui)
target_include_directories(test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/library/frameworks/imgui-sfml)

When I compile, I get this message.

CMake Error at CMakeLists.txt:22 (find_package):
  By not providing "FindImGui-SFML.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "ImGui-SFML", but CMake did not find one.

  Could not find a package configuration file provided by "ImGui-SFML" with
  any of the following names:

    ImGui-SFMLConfig.cmake
    imgui-sfml-config.cmake

  Add the installation prefix of "ImGui-SFML" to CMAKE_PREFIX_PATH or set
  "ImGui-SFML_DIR" to a directory containing one of the above files.  If
  "ImGui-SFML" provides a separate development package or SDK, be sure it has
  been installed.

image

I can't figure out where I get the FindImGui-SFML.cmake file from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions