build: restrict MSVC static libs to .lib only

The MSVC linker can now apparently link MinGW .a static libs too, and
StrawberryPerl pollutes the build with its own.

Set CMAKE_FIND_LIBRARY_SUFFIXES to .lib only when MSVC is true for
static builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-11-28 10:23:33 -08:00
parent 5807376fba
commit 6d8ca723d0
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 5 additions and 3 deletions

View File

@ -118,7 +118,9 @@ if(VBAM_STATIC)
set_property(GLOBAL PROPERTY LINK_SEARCH_START_STATIC ON)
set_property(GLOBAL PROPERTY LINK_SEARCH_END_STATIC ON)
if(NOT MSVC)
if(MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
else()
list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .a)
endif()
endif()

View File

@ -102,8 +102,8 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h
SET(CURRENT_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(SDL2_STATIC)
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a)
if(MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()