Setting up ImGUI 1.91.8 in Visual Studio 2022 using CMake
        
            - Install ImGUI using this guide: How to install ImGUI 1.91.8 using CMake and Visual Studio 2022 for Desktop
 
            - Install SDL3 3.2.4 using this guide: How to install SDL 3.2.4 using CMake and Visual Studio 2022 for Desktop
 
            - Run Visual Studio
 
            - Click on the "Create a new project" button:
 
            
            - Click on the "CMake Project" and click on the "Next" button:
 
            
            - Type a project name, set a project location, check the "Place solution and project in the same directory" checkbox, and click on the "Create" button:
 
            
            - Wait a few seconds for configuration
 
            - Run the project by click on the empty green triangle (or Ctrl+F5):
 
            
            - The program prints "Hello CMake" to the console:
 
            
            - Double click on the "CMakeLists.txt" file:
 
            
            - Add this code to the "CMakeLists.txt" file
 
target_include_directories(hello-imgui PRIVATE E:/libs/glad-2.0.8/include)
target_include_directories(hello-imgui PRIVATE E:/libs/imgui-1.91.8-sdl3-opengl3-msvc/win/debug/include)
target_sources(hello-imgui
PRIVATE
    E:/libs/glad-2.0.8/src/glad.c
    E:/libs/imgui-1.91.8-sdl3-opengl3-msvc/win/debug/src/imgui_impl_opengl3.cpp
    E:/libs/imgui-1.91.8-sdl3-opengl3-msvc/win/debug/src/imgui_impl_sdl3.cpp
)
find_package(SDL3)
target_link_directories(hello-imgui PRIVATE E:/libs/imgui-1.91.8-sdl3-opengl3-msvc/win/debug/lib)
target_link_libraries(hello-imgui PRIVATE SDL3::SDL3 ImGui opengl32)
            Note. You do not need to add paths to SDL3 in the "CMakePresets.json" file if you added a path to SDL3/bin to the PATH, for example, I added the following path to the PATH: "E:\libs\sdl-3.1.10-msvc\win\debug\bin"
            Double click on the "hello-imgui.cpp" file:
            
            Replace the "hello-imgui.cpp" file content with this one:
#define SDL_MAIN_USE_CALLBACKS 1 // Use the callbacks instead of main()
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <glad/glad.h>
#include <iostream>
#include <vector>
#include <imgui_impl_opengl3.h>
#include <imgui_impl_sdl3.h>
struct AppContext
{
    SDL_Window* window;
    SDL_GLContext glContext;
    SDL_AppResult appQuit = SDL_APP_CONTINUE;
};
SDL_AppResult SDL_Fail()
{
    SDL_LogError(SDL_LOG_CATEGORY_CUSTOM, "Error %s", SDL_GetError());
    return SDL_APP_FAILURE;
}
SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[])
{
    // init the library, here we make a window so we only need the Video capabilities.
    if (!SDL_Init(SDL_INIT_VIDEO))
    {
        return SDL_Fail();
    }
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); // Enable MULTISAMPLE
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); // can be 2, 4, 8 or 16
    // Create a window
    SDL_Window* window = SDL_CreateWindow("SDL3, OpenGL 2.1, C++", 500, 500,
        SDL_WINDOW_OPENGL); // | SDL_WINDOW_RESIZABLE
    if (!window)
    {
        return SDL_Fail();
    }
    SDL_GLContext glContext = SDL_GL_CreateContext(window);
    if (!glContext)
    {
        return SDL_Fail();
    }
    SDL_GL_SetSwapInterval(1); // Turn on vertical sync
    if (!gladLoadGL())
    {
        std::cout << "Failed to load OpenGL functions" << std::endl;
        return SDL_APP_FAILURE;
    }
    glClearColor(0.188f, 0.22f, 0.255f, 1.f);
    // Setup Dear ImGui context
    IMGUI_CHECKVERSION();
    ImGui::CreateContext();
    ImGuiIO& io = ImGui::GetIO();
    (void)io;
    // Setup Dear ImGui style
    ImGui::StyleColorsDark();
    // ImGui::StyleColorsLight();
    // Setup Platform/Renderer bindings
    ImGui_ImplSDL3_InitForOpenGL(window, glContext);
    ImGui_ImplOpenGL3_Init();
    SDL_ShowWindow(window);
    // set up the application data
    *appstate = new AppContext{
        window,
        glContext,
    };
    return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
{
    auto* app = (AppContext*)appstate;
    ImGui_ImplSDL3_ProcessEvent(event);
    switch (event->type)
    {
        case SDL_EVENT_QUIT:
        {
            app->appQuit = SDL_APP_SUCCESS;
            break;
        }
        default:
        {
            break;
        }
    }
    return SDL_APP_CONTINUE;
}
SDL_AppResult SDL_AppIterate(void* appstate)
{
    auto* app = (AppContext*)appstate;
    // Start the Dear ImGui frame
    ImGui_ImplOpenGL3_NewFrame();
    ImGui_ImplSDL3_NewFrame();
    ImGui::NewFrame();
    ImGui::Begin("Another Window");
    ImGui::Text("Hello from another window!");
    if (ImGui::Button("Click Me"))
        std::cout << "clicked" << std::endl;
    ImGui::End();
    ImGui::Render();
    ImGuiIO& io = ImGui::GetIO();
    glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
    // Clear the canvas
    glClear(GL_COLOR_BUFFER_BIT);
    // Draw something here
    // Draw GUI
    ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
    SDL_GL_SwapWindow(app->window);
    return app->appQuit;
}
void SDL_AppQuit(void* appstate, SDL_AppResult result)
{
    auto* app = (AppContext*)appstate;
    if (app)
    {
        SDL_GL_DestroyContext(app->glContext);
        SDL_DestroyWindow(app->window);
        delete app;
    }
    // Cleanup
    ImGui_ImplOpenGL3_Shutdown();
    ImGui_ImplSDL3_Shutdown();
    ImGui::DestroyContext();
    SDL_Quit();
}
            Press Ctrl+F5 to run the application
            You see the following result. Click the "Click Me" button to see the "clicked" in the console: