SDL2_ttf CMake error

Hi all. I am trying to build a basic SDL2 project using SDL_net and SDL_ttf using CMake on Windows 10, but I am having issues building the project using CMake’s FetchContent. Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.14)

...

include(FetchContent)

FetchContent_Declare(
    SDL
    GIT_REPOSITORY https://github.com/libsdl-org/SDL
    GIT_TAG release-2.24.0
    SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/SDL)

FetchContent_Declare(
    SDL_net
    GIT_REPOSITORY https://github.com/libsdl-org/SDL_net
    GIT_TAG release-2.2.0
    SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/SDL_net)

FetchContent_Declare(
    SDL_ttf
    GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf
    GIT_TAG release-2.20.1
    SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/SDL_ttf)

FetchContent_MakeAvailable(SDL SDL_net SDL_ttf)
find_package(OpenGL REQUIRED)

add_executable(
    client
    main.c)
target_link_libraries(
    client
    OpenGL::GL
    SDL2::SDL2
    SDL2::SDL2main
    SDL2_net::SDL2_net
    SDL2_ttf::SDL2_ttf)
target_link_libraries(client SDL2::SDL2main)

Here is the build step output:

PS> cmake ..
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
--
-- SDL2 was configured with the following options:
--
-- Platform: Windows-10.0.19044
-- 64-bit:   TRUE
-- Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe
-- Revision:
--
-- Subsystems:
--   Atomic:    ON
--   Audio:     ON
--   Video:     ON
--   Render:    ON
--   Events:    ON
--   Joystick:  ON
--   Haptic:    ON
--   Hidapi:    ON
--   Power:     ON
--   Threads:   ON
--   Timers:    ON
--   File:      ON
--   Loadso:    ON
--   CPUinfo:   ON
--   Filesystem:        ON
--   Sensor:    ON
--   Locale:    ON
--   Misc:      ON
--
-- Options:
--   SDL2_DISABLE_INSTALL        (Wanted: ON): OFF
--   SDL2_DISABLE_SDL2MAIN       (Wanted: OFF): OFF
--   SDL2_DISABLE_UNINSTALL      (Wanted: OFF): OFF
--   SDL_3DNOW                   (Wanted: ON): OFF
--   SDL_ALSA                    (Wanted: OFF): OFF
--   SDL_ALSA_SHARED             (Wanted: OFF): OFF
--   SDL_ALTIVEC                 (Wanted: ON): OFF
--   SDL_ARMNEON                 (Wanted: OFF): OFF
--   SDL_ARMSIMD                 (Wanted: OFF): OFF
--   SDL_ARTS                    (Wanted: OFF): OFF
--   SDL_ARTS_SHARED             (Wanted: OFF): OFF
--   SDL_ASAN                    (Wanted: OFF): OFF
--   SDL_ASSEMBLY                (Wanted: ON): OFF
--   SDL_ASSERTIONS              (Wanted: auto): auto
--   SDL_BACKGROUNDING_SIGNAL    (Wanted: OFF): OFF
--   SDL_CLOCK_GETTIME           (Wanted: OFF): OFF
--   SDL_COCOA                   (Wanted: OFF): OFF
--   SDL_DIRECTFB                (Wanted: OFF): OFF
--   SDL_DIRECTFB_SHARED         (Wanted: OFF): OFF
--   SDL_DIRECTX                 (Wanted: ON): ON
--   SDL_DISKAUDIO               (Wanted: ON): ON
--   SDL_DUMMYAUDIO              (Wanted: ON): ON
--   SDL_DUMMYVIDEO              (Wanted: ON): ON
--   SDL_ESD                     (Wanted: OFF): OFF
--   SDL_ESD_SHARED              (Wanted: OFF): OFF
--   SDL_FOREGROUNDING_SIGNAL    (Wanted: OFF): OFF
--   SDL_FUSIONSOUND             (Wanted: OFF): OFF
--   SDL_FUSIONSOUND_SHARED      (Wanted: OFF): OFF
--   SDL_GCC_ATOMICS             (Wanted: OFF): OFF
--   SDL_HIDAPI                  (Wanted: ON): ON
--   SDL_HIDAPI_JOYSTICK         (Wanted: ON): ON
--   SDL_HIDAPI_LIBUSB           (Wanted: OFF): OFF
--   SDL_INSTALL_TESTS           (Wanted: OFF): OFF
--   SDL_JACK                    (Wanted: OFF): OFF
--   SDL_JACK_SHARED             (Wanted: OFF): OFF
--   SDL_KMSDRM                  (Wanted: OFF): OFF
--   SDL_KMSDRM_SHARED           (Wanted: OFF): OFF
--   SDL_LIBC                    (Wanted: OFF): OFF
--   SDL_LIBSAMPLERATE           (Wanted: OFF): OFF
--   SDL_LIBSAMPLERATE_SHARED    (Wanted: OFF): OFF
--   SDL_METAL                   (Wanted: OFF): OFF
--   SDL_MMX                     (Wanted: ON): OFF
--   SDL_NAS                     (Wanted: OFF): OFF
--   SDL_NAS_SHARED              (Wanted: OFF): OFF
--   SDL_OFFSCREEN               (Wanted: OFF): OFF
--   SDL_OPENGL                  (Wanted: ON): ON
--   SDL_OPENGLES                (Wanted: ON): ON
--   SDL_OSS                     (Wanted: OFF): OFF
--   SDL_PIPEWIRE                (Wanted: OFF): OFF
--   SDL_PIPEWIRE_SHARED         (Wanted: OFF): OFF
--   SDL_PTHREADS                (Wanted: OFF): OFF
--   SDL_PTHREADS_SEM            (Wanted: OFF): OFF
--   SDL_PULSEAUDIO              (Wanted: OFF): OFF
--   SDL_PULSEAUDIO_SHARED       (Wanted: OFF): OFF
--   SDL_RENDER_D3D              (Wanted: ON): ON
--   SDL_RENDER_METAL            (Wanted: OFF): OFF
--   SDL_RPATH                   (Wanted: OFF): OFF
--   SDL_RPI                     (Wanted: OFF): OFF
--   SDL_SNDIO                   (Wanted: OFF): OFF
--   SDL_SNDIO_SHARED            (Wanted: OFF): OFF
--   SDL_SSE                     (Wanted: ON): ON
--   SDL_SSE2                    (Wanted: ON): ON
--   SDL_SSE3                    (Wanted: ON): ON
--   SDL_SSEMATH                 (Wanted: ON): OFF
--   SDL_STATIC_PIC              (Wanted: OFF): OFF
--   SDL_TESTS                   (Wanted: OFF): OFF
--   SDL_VIRTUAL_JOYSTICK        (Wanted: ON): ON
--   SDL_VIVANTE                 (Wanted: OFF): OFF
--   SDL_VULKAN                  (Wanted: ON): ON
--   SDL_WASAPI                  (Wanted: ON): ON
--   SDL_WAYLAND                 (Wanted: OFF): OFF
--   SDL_WAYLAND_LIBDECOR        (Wanted: OFF): OFF
--   SDL_WAYLAND_LIBDECOR_SHARED (Wanted: OFF): OFF
--   SDL_WAYLAND_QT_TOUCH        (Wanted: OFF): OFF
--   SDL_WAYLAND_SHARED          (Wanted: OFF): OFF
--   SDL_X11                     (Wanted: OFF): OFF
--   SDL_X11_SHARED              (Wanted: OFF): OFF
--   SDL_X11_XCURSOR             (Wanted: OFF): OFF
--   SDL_X11_XDBE                (Wanted: OFF): OFF
--   SDL_X11_XFIXES              (Wanted: OFF): OFF
--   SDL_X11_XINPUT              (Wanted: OFF): OFF
--   SDL_X11_XRANDR              (Wanted: OFF): OFF
--   SDL_X11_XSCRNSAVER          (Wanted: OFF): OFF
--   SDL_X11_XSHAPE              (Wanted: OFF): OFF
--   SDL_XINPUT                  (Wanted: ON): ON
--
--  CFLAGS:        /DWIN32 /D_WINDOWS /W3
--  EXTRA_CFLAGS:
--  EXTRA_LDFLAGS:
--  EXTRA_LIBS:    user32;gdi32;winmm;imm32;ole32;oleaut32;version;uuid;advapi32;setupapi;shell32;dinput8
--
--  Build Shared Library: ON
--  Build Static Library: ON
--  Build Static Library with Position Independent Code: OFF
--
-- Configuring SDL2_net 2.2.0
-- Configuring SDL2_ttf 2.20.1
-- SDL2_ttf: Using vendored freetype library
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Configuring done
CMake Error: install(EXPORT "SDL2_ttfTargets" ...) includes target "SDL2_ttf" which requires target "SDL2" that is not in any export set.
CMake Error: install(EXPORT "SDL2_ttfTargets" ...) includes target "SDL2_ttf" which requires target "SDL2" that is not in any export set.
CMake Error: install(EXPORT "SDL2_ttfTargets" ...) includes target "SDL2_ttf" which requires target "SDL2" that is not in any export set.
CMake Error: install(EXPORT "SDL2_ttfTargets" ...) includes target "SDL2_ttf" which requires target "SDL2" that is not in any export set.
-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Has anyone ran into this issue before, and if so, how can it be resolved? Please let me know if I can provide any more information that would help. Thanks!

All–seems like the solution was to downgrade the SDL version to ‘release-2.0.22’.