cmake: only link SetupAPI on win32 if it's found

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-04-15 13:11:00 +00:00
parent af63a1194f
commit d28fd302aa
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 5 additions and 1 deletions

View File

@ -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)