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

How to build Imgui example? #64

Closed
DmitriySalnikov opened this issue Jul 30, 2019 · 7 comments
Closed

How to build Imgui example? #64

DmitriySalnikov opened this issue Jul 30, 2019 · 7 comments

Comments

@DmitriySalnikov
Copy link

I have no problems with compiling MagnumIntegration::ImGui but Imgui example can't builded.
All packages installed via vcpkg.

1> CMake generation started for configuration: 'x64-Debug'.
1> The toolchain file has changed (CMAKE_TOOLCHAIN_FILE).
1> Command line: "cmd.exe" /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="D:\Repositories\Magnum\magnum-examples\out\install\x64-Debug" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DWITH_BOX2D_EXAMPLE:BOOL="False" -DWITH_BULLET_EXAMPLE:BOOL="False" -DWITH_CUBEMAP_EXAMPLE:BOOL="False" -DWITH_AUDIO_EXAMPLE:BOOL="False" -DWITH_IMGUI_EXAMPLE:BOOL="True" -DWITH_MOUSEINTERACTION_EXAMPLE:BOOL="False" -DWITH_MOTIONBLUR_EXAMPLE:BOOL="False" -DWITH_PICKING_EXAMPLE:BOOL="False" -DWITH_PRIMITIVES_EXAMPLE:BOOL="False" -DWITH_SHADOWS_EXAMPLE:BOOL="False" -DWITH_TEXT_EXAMPLE:BOOL="False" -DWITH_TEXTUREDTRIANGLE_EXAMPLE:BOOL="False" -DWITH_TRIANGLE_EXAMPLE:BOOL="False" -DCMAKE_CXX_COMPILER:FILEPATH="c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe"  -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "D:\Repositories\Magnum\magnum-examples" 2>&1"
1> Working directory: D:\Repositories\Magnum\magnum-examples\out\build\x64-Debug
1> [CMake] -- The CXX compiler identification is MSVC 19.22.27905.0
1> [CMake] -- Check for working CXX compiler: c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working CXX compiler: c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe -- works
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] -- Found Corrade: C:/My/vcpkg/installed/x64-windows-static/include  found components:  Containers rc Utility 
1> [CMake] -- Found Magnum: C:/My/vcpkg/installed/x64-windows-static/include   
1> [CMake] -- LIB_SUFFIX variable is not defined. It will be autodetected now.
1> [CMake] -- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
1> [CMake] -- LIB_SUFFIX autodetected as '', libraries will be installed into D:/Repositories/Magnum/magnum-examples/out/install/x64-Debug/lib
1> [CMake] -- The C compiler identification is MSVC 19.22.27905.0
1> [CMake] -- Check for working C compiler: c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working C compiler: c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe -- works
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Found OpenGL: opengl32   
1> [CMake] -- Found Magnum: C:/My/vcpkg/installed/x64-windows-static/include  found components:  GL 
1> [CMake] CMake Error at modules/FindImGui.cmake:83 (get_target_property):
1> [CMake]   get_target_property() called with non-existent target "imgui::imgui".
1> [CMake] Call Stack (most recent call first):
1> [CMake]   C:/My/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package)
1> [CMake]   modules/FindMagnumIntegration.cmake:212 (find_package)
1> [CMake]   C:/My/vcpkg/scripts/buildsystems/vcpkg.cmake:266 (_find_package)
1> [CMake]   src/imgui/CMakeLists.txt:44 (find_package)
1> [CMake] -- Could NOT find ImGui (missing: ImGui_INCLUDE_DIR) 
1> [CMake] -- Found MagnumIntegration: C:/My/vcpkg/installed/x64-windows-static/include  found components:  ImGui 
1> [CMake] -- Found SDL2: optimized;C:/My/vcpkg/installed/x64-windows-static/lib/SDL2.lib;debug;C:/My/vcpkg/installed/x64-windows-static/debug/lib/SDL2d.lib  
1> [CMake] -- Found Magnum: C:/My/vcpkg/installed/x64-windows-static/include  found components:  GL Sdl2Application 
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "D:/Repositories/Magnum/magnum-examples/out/build/x64-Debug/CMakeFiles/CMakeOutput.log".
1> [CMake] 
1> cmd.exe /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="D:\Repositories\Magnum\magnum-examples\out\install\x64-Debug" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DWITH_BOX2D_EXAMPLE:BOOL="False" -DWITH_BULLET_EXAMPLE:BOOL="False" -DWITH_CUBEMAP_EXAMPLE:BOOL="False" -DWITH_AUDIO_EXAMPLE:BOOL="False" -DWITH_IMGUI_EXAMPLE:BOOL="True" -DWITH_MOUSEINTERACTION_EXAMPLE:BOOL="False" -DWITH_MOTIONBLUR_EXAMPLE:BOOL="False" -DWITH_PICKING_EXAMPLE:BOOL="False" -DWITH_PRIMITIVES_EXAMPLE:BOOL="False" -DWITH_SHADOWS_EXAMPLE:BOOL="False" -DWITH_TEXT_EXAMPLE:BOOL="False" -DWITH_TEXTUREDTRIANGLE_EXAMPLE:BOOL="False" -DWITH_TRIANGLE_EXAMPLE:BOOL="False" -DCMAKE_CXX_COMPILER:FILEPATH="c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe"  -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "D:\Repositories\Magnum\magnum-examples" 2>&1" returned with exit code: 1

And this my try to integrate imgui to new project.

cmake_minimum_required (VERSION 3.5)
project ("SimpleGame")

find_package(Magnum REQUIRED)
find_package(MagnumIntegration REQUIRED ImGui)

if(CORRADE_TARGET_WINDOWS)
    add_definitions("-DUNICODE" "-D_UNICODE")
endif()
if(CORRADE_TARGET_ANDROID)
    find_package(Magnum REQUIRED AndroidApplication)
elseif(CORRADE_TARGET_EMSCRIPTEN)
    find_package(Magnum REQUIRED EmscriptenApplication)
else()
    find_package(Magnum REQUIRED Sdl2Application)
endif()

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)

add_executable (SimpleGame "SimpleGame.cpp")
target_link_libraries(SimpleGame PRIVATE
    Magnum::Application
    Magnum::GL
    Magnum::Magnum
    MagnumIntegration::ImGui)
1> CMake generation started for configuration: 'x64-Debug'.
1> The toolchain file has changed (CMAKE_TOOLCHAIN_FILE).
1> Command line: "cmd.exe" /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\My\Projects\VS\SimpleGame\out\install\x64-Debug" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe"  -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\My\Projects\VS\SimpleGame" 2>&1"
1> Working directory: C:\My\Projects\VS\SimpleGame\out\build\x64-Debug
1> [CMake] -- The C compiler identification is MSVC 19.22.27905.0
1> [CMake] -- The CXX compiler identification is MSVC 19.22.27905.0
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe -- works
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe -- works
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] -- Found Corrade: C:/My/vcpkg/installed/x64-windows-static/include  found components:  Containers rc Utility 
1> [CMake] -- Found Magnum: C:/My/vcpkg/installed/x64-windows-static/include   
1> [CMake] -- LIB_SUFFIX variable is not defined. It will be autodetected now.
1> [CMake] -- You can set it manually with -DLIB_SUFFIX=<value> (64 for example)
1> [CMake] -- LIB_SUFFIX autodetected as '', libraries will be installed into C:/My/Projects/VS/SimpleGame/out/install/x64-Debug/lib
1> [CMake] -- Found OpenGL: opengl32   
1> [CMake] -- Found Magnum: C:/My/vcpkg/installed/x64-windows-static/include  found components:  GL 
1> [CMake] -- Found MagnumIntegration: C:/My/vcpkg/installed/x64-windows-static/include  found components:  ImGui 
1> [CMake] -- Found Magnum: C:/My/vcpkg/installed/x64-windows-static/include  found components:  GL Sdl2Application 
1> [CMake] -- Configuring done
1> [CMake] CMake Error at C:/My/vcpkg/scripts/buildsystems/vcpkg.cmake:169 (_add_executable):
1> [CMake]   Target "SimpleGame" links to target "ImGui::ImGui" but the target was not
1> [CMake]   found.  Perhaps a find_package() call is missing for an IMPORTED target, or
1> [CMake]   an ALIAS target is missing?
1> [CMake] Call Stack (most recent call first):
1> [CMake]   SimpleGame/CMakeLists.txt:27 (add_executable)
1> [CMake] CMake Error at C:/My/vcpkg/scripts/buildsystems/vcpkg.cmake:169 (_add_executable):
1> [CMake]   Target "SimpleGame" links to target "ImGui::ImGui" but the target was not
1> [CMake]   found.  Perhaps a find_package() call is missing for an IMPORTED target, or
1> [CMake]   an ALIAS target is missing?
1> [CMake] Call Stack (most recent call first):
1> [CMake]   SimpleGame/CMakeLists.txt:27 (add_executable)
1> [CMake] -- Generating done
1> [CMake] -- Build files have been written to: C:/My/Projects/VS/SimpleGame/out/build/x64-Debug
1> [CMake] 
1> cmd.exe /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\My\Projects\VS\SimpleGame\out\install\x64-Debug" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/HostX64/x64/cl.exe"  -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\My\Projects\VS\SimpleGame" 2>&1" returned with exit code: 1
@mosra mosra added this to the 2019.0b milestone Jul 30, 2019
@mosra
Copy link
Owner

mosra commented Jul 30, 2019

Hi,

thank you for the very detailed report. For the second case the project is missing a copy of the FindImGui.cmake module, which is here, together witht that you'll need also

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})

set in CMake (assuming the FindImGui.cmake module is put in the modules/ subdirectory). You did this most probably for FindSDL2.cmake already. After you do that ... you'll most definitely end up at the first problem 😅

For the first problem -- it looks like there's some clash of targets. Since it worked when building the integration library itself (which depends on imgui from vcpkg), I don't think it's due to vcpkg being broken -- but somehow the imguiConfig.cmake the imgui vcpkg package installs doesn't get executed properly, failing to create the imgui::imgui target. Can you search your system for files named imguiConfig.cmake? Maybe there's some other one which somehow takes a priority and is causing things to break?

@Squareys, any chance you ever encountered this issue?

@DmitriySalnikov
Copy link
Author

DmitriySalnikov commented Jul 30, 2019

i have only that imguiConfig.cmake in "installed" and "packages" folders

These file pairs are identical (that's all I found):
image

# Generated by CMake

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
   message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget imgui::imgui)
  list(APPEND _expectedTargets ${_expectedTarget})
  if(NOT TARGET ${_expectedTarget})
    list(APPEND _targetsNotDefined ${_expectedTarget})
  endif()
  if(TARGET ${_expectedTarget})
    list(APPEND _targetsDefined ${_expectedTarget})
  endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  unset(_targetsDefined)
  unset(_targetsNotDefined)
  unset(_expectedTargets)
  set(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)


# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

# Create imported target imgui::imgui
add_library(imgui::imgui STATIC IMPORTED)

set_target_properties(imgui::imgui PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/imguiConfig-*.cmake")
foreach(f ${CONFIG_FILES})
  include(${f})
endforeach()

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
  foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
    if(NOT EXISTS "${file}" )
      message(FATAL_ERROR "The imported target \"${target}\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

@DmitriySalnikov
Copy link
Author

Here is another person with the same problem: microsoft/vcpkg#5911

@DmitriySalnikov
Copy link
Author

DmitriySalnikov commented Jul 30, 2019

I found solution.
Just install all packages without '-static' suffix in triplets (x64-windows instead x64-windows-static).

but my test project still dont works.

@mosra
Copy link
Owner

mosra commented Aug 1, 2019

The linked problem is different from what you are encountering here and the solution to that one is identical to what I said above.

Just install all packages without '-static' suffix in triplets (x64-windows instead x64-windows-static).

Glad to hear there's some solution :) Interesting -- can you check how the imguiConfig.cmake files look in this case? Is there any difference? Ideally put one here again.

but my test project still dont works.

Is it still complaining about Target "SimpleGame" links to target "ImGui::ImGui" but the target was not found or is it something different now? Did you set up the module folder and put the FindImGui.cmake file there like I said above?

@DmitriySalnikov
Copy link
Author

can you check how the imguiConfig.cmake files look in this case? Is there any difference? Ideally put one here again.

I think this file has not changed.

spoiler
# Generated by CMake

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
   message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget imgui::imgui)
  list(APPEND _expectedTargets ${_expectedTarget})
  if(NOT TARGET ${_expectedTarget})
    list(APPEND _targetsNotDefined ${_expectedTarget})
  endif()
  if(TARGET ${_expectedTarget})
    list(APPEND _targetsDefined ${_expectedTarget})
  endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  unset(_targetsDefined)
  unset(_targetsNotDefined)
  unset(_expectedTargets)
  set(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)


# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

# Create imported target imgui::imgui
add_library(imgui::imgui STATIC IMPORTED)

set_target_properties(imgui::imgui PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/imguiConfig-*.cmake")
foreach(f ${CONFIG_FILES})
  include(${f})
endforeach()

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
  foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
    if(NOT EXISTS "${file}" )
      message(FATAL_ERROR "The imported target \"${target}\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

You're right, thank you. I have not copied the modules to my project.

set in CMake (assuming the FindImGui.cmake module is put in the modules/ subdirectory). You did this most probably for FindSDL2.cmake already. After you do that ... you'll most definitely end up at the first problem 😅

But I didn't understand this message then because I didn't copy 'FindSDL2'.cmake' and didn't see any problems with SDL2. And still don't know why reinstalling all packages without '-static' helped build the examples.
I was too sleepy to read this https://doc.magnum.graphics/magnum/getting-started.html#getting-started-review 😅
Sorry for such a stupid question 😓
In the future, I will read the documentation more carefully.
Thank You

@mosra mosra added this to TODO in Project management via automation Aug 3, 2019
@mosra
Copy link
Owner

mosra commented Aug 3, 2019

No worries, you're not the first one getting stuck on this ;)

I updated the ImGuiIntegration docs to hopefully make this requirement clearer (mosra/magnum-integration@221030a).

@mosra mosra moved this from TODO to Done in Project management Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants