CMake: Updates for CMake 3.25 and later on Windows.

https://cmake.org/cmake/help/latest/release/3.25.html says:

"On Windows, when targeting the MSVC ABI, the find_library() command now
accepts .a file names after first considering .lib. This is symmetric
with existing behavior when targeting the GNU ABI, in which the command
accepts .lib file names after first considering .a."

If "MSVC" is defined, only search for libsmi-2. This keeps us from finding
libsmi.a. Set NO_SYSTEM_ENVIRONMENT_PATH when we're searching for zlib. This
keeps us from finding Strawberry Perl's version.

Some SpanDSP builds link with LibTIFF, but our Windows version doesn't.
This commit is contained in:
Gerald Combs 2022-11-27 15:04:13 -08:00
parent a0d77e9329
commit 0af3174508
4 changed files with 24 additions and 3 deletions

View File

@ -5,3 +5,11 @@ indent_size = 4
[FindSinsp.cmake]
indent_style = space
indent_size = 2
[FindSMI.cmake]
indent_style = space
indent_size = 2
[FindSPANDSP.cmake]
indent_style = space
indent_size = 2

View File

@ -20,7 +20,11 @@ FindWSWinLibs("libsmi-.*" "SMI_HINTS")
FIND_PATH(SMI_INCLUDE_DIR smi.h HINTS "${SMI_HINTS}/include" )
SET(SMI_NAMES smi libsmi-2)
IF(MSVC)
SET(SMI_NAMES libsmi-2)
ELSE()
SET(SMI_NAMES smi libsmi-2)
ENDIF()
FIND_LIBRARY(SMI_LIBRARY NAMES ${SMI_NAMES} HINTS "${SMI_HINTS}/lib" )
# handle the QUIETLY and REQUIRED arguments and set SMI_FOUND to TRUE if

View File

@ -12,10 +12,11 @@ FindWSWinLibs( "spandsp-.*" "SPANDSP_HINTS" )
if( NOT WIN32)
find_package(PkgConfig)
pkg_search_module(SPANDSP spandsp)
# spandsp.h might include tiffio.h.
find_package(TIFF QUIET)
endif()
# spandsp.h includes tiffio.h.
find_package(TIFF QUIET)
find_path( SPANDSP_INCLUDE_DIR
NAMES spandsp.h

View File

@ -39,6 +39,11 @@ include( FindWSWinLibs )
# Zlib is included with GLib2
FindWSWinLibs( "vcpkg-export-*" "ZLIB_HINTS" )
if(MSVC)
# else we'll find Strawberry Perl's version
set (_zlib_sys_env_option NO_SYSTEM_ENVIRONMENT_PATH)
endif()
if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
if (NOT WIN32) # else we'll find Strawberry Perl's pkgconfig
find_package(PkgConfig)
@ -54,6 +59,7 @@ if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
${ZLIB_HINTS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include"
${_zlib_sys_env_option}
)
SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1)
@ -66,8 +72,10 @@ if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
${ZLIB_HINTS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib"
${_zlib_sys_env_option}
)
endif()
unset(_zlib_sys_env_option)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if