From d28fd302aa2bcfa94999495eb968d8a4f5c9ed9d Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Mon, 15 Apr 2019 13:11:00 +0000 Subject: [PATCH] cmake: only link SetupAPI on win32 if it's found Signed-off-by: Rafael Kitover --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86026d9d..7a7628d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,11 @@ find_package(SDL2 REQUIRED) add_definitions(${SDL2_DEFINITIONS}) if(WIN32) - set(SDL2_LIBRARY ${SDL2_LIBRARY} -lSetupAPI) + find_library(SETUPAPI_LIBRARY SetupAPI) + + if(SETUPAPI_LIBRARY) + set(SDL2_LIBRARY ${SDL2_LIBRARY} ${SETUPAPI_LIBRARY}) + endif() endif() if(ENABLE_LINK)