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

[imgui-sfml] cmake ... contains: OpenGL::GL but the target was not found ... #44123

Open
pascal754 opened this issue Mar 3, 2025 · 1 comment · May be fixed by #44203
Open

[imgui-sfml] cmake ... contains: OpenGL::GL but the target was not found ... #44123

pascal754 opened this issue Mar 3, 2025 · 1 comment · May be fixed by #44203
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@pascal754
Copy link

Describe the bug

> cmake -B Debug
-- Building for: Visual Studio 17 2022
-- The C compiler identification is MSVC 19.44.34823.2
-- The CXX compiler identification is MSVC 19.44.34823.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.44.34823/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.44.34823/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found SFML 3.0.0 in C:/vcpkg/installed/x64-windows/share/sfml
-- Found SFML 3.0.0 in C:/vcpkg/installed/x64-windows/share/sfml
-- Configuring done (3.8s)
CMake Error at C:/vcpkg/installed/x64-windows/share/imgui-sfml/ImGui-SFMLConfig.cmake:63 (set_target_properties):
  The link interface of target "ImGui-SFML::ImGui-SFML" contains:

    OpenGL::GL

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  C:/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
  CMakeLists.txt:11 (find_package)


-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

Environment

  • OS: Windows 11
  • Compiler: Visual Studio Community 2022 (64-bit) Version 17.14.0 Preview 1.1

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install imgui imgui-sfml sfml
imgui-sfml:x64-windows                            3.0     
imgui:x64-windows                                 1.91.8#4
sfml:x64-windows                                  3.0.0
  1. CMakeLists.txt and the code
cmake_minimum_required(VERSION 3.26)

set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")

# imgui sfml minimal example
project(ex)

set(CMAKE_CXX_STANDARD 23)

find_package(imgui CONFIG REQUIRED)
find_package(ImGui-SFML CONFIG REQUIRED)
find_package(SFML COMPONENTS Graphics CONFIG REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(
  ${PROJECT_NAME}
  PRIVATE
    imgui::imgui
    ImGui-SFML::ImGui-SFML
    SFML::Graphics
)
#include "imgui.h" // necessary for ImGui::*, imgui-SFML.h doesn't include imgui.h

#include "imgui-SFML.h" // for ImGui::SFML::* functions and SFML-specific overloads

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode({640, 480}), "ImGui + SFML = <3");
    window.setFramerateLimit(60);
    if (!ImGui::SFML::Init(window))
        return -1;

    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    sf::Clock deltaClock;
    while (window.isOpen())
    {
        while (const auto event = window.pollEvent())
        {
            ImGui::SFML::ProcessEvent(window, *event);

            if (event->is<sf::Event::Closed>())
            {
                window.close();
            }
        }

        ImGui::SFML::Update(window, deltaClock.restart());

        ImGui::ShowDemoWindow();

        ImGui::Begin("Hello, world!");
        ImGui::Button("Look at this pretty button");
        ImGui::End();

        window.clear();
        window.draw(shape);
        ImGui::SFML::Render(window);
        window.display();
    }

    ImGui::SFML::Shutdown();
}

Additional context

  • On Linux, the code builds and runs.
@MonicaLiu0311 MonicaLiu0311 added the category:port-bug The issue is with a library, which is something the port should already support label Mar 3, 2025
@MonicaLiu0311
Copy link
Contributor

Confirmed, repro locally.

PS E:\vcpkg> ./vcpkg version
vcpkg package management program version 2025-02-11-bec4296bf5289dc9ce83b4f5095943e44162f9c2

See LICENSE.txt for license information.

@MonicaLiu0311 MonicaLiu0311 linked a pull request Mar 6, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants