Linking to the debug SDL2 build on mac osx

I’ve compiled the sources using cmake -DCMAKE_BUILD_TYPE=Debug .. which generates libraries with the d suffix (like libSDL2-2.0d.dylib), and I install them with make && make install.

But my simple proof-of-concept project (show a window for a couple seconds) can’t find the sdl libraries. I’m using the FindSDL2.cmake files from https://github.com/aminosbh/sdl2-cmake-modules, but it returns:

CMake Error at /usr/local/Cellar/cmake/3.15.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find SDL2 (missing: SDL2_LIBRARY) (found version "2.0.10")

I don’t have this problem when building and installing the Release versions. I know it’s my fault for not really understanding the CMake magic happening here, so even a pointer to what I need to learn (what to call this problem I’m having – I’ll do the reading myself) even that would be a help.

Thanks!

Here’s what my CMakeLists.txt file looks like:

cmake_minimum_required(VERSION 3.15)
project(HandmadeHero VERSION 0.0.1)

set(CMAKE_CXX_STANDARD 17)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)

find_package(SDL2 REQUIRED)

add_executable(HandmadeHero main.cpp)

target_link_libraries(${PROJECT_NAME} SDL2::Main)

The ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2 path is where the FindSDL2.cmake files are located.