aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-11-27 15:04:13 -0800
committerGerald Combs <gerald@wireshark.org>2022-11-28 19:15:48 +0000
commit0af31745082d2bf75d79c6827381e819f6db8df9 (patch)
treeecf87853c1e1b25b3b19d91e0a114147a84c30e2 /cmake/modules
parenta0d77e93298ab2e62600ec835099691b37fce69b (diff)
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.
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/.editorconfig8
-rw-r--r--cmake/modules/FindSMI.cmake6
-rw-r--r--cmake/modules/FindSPANDSP.cmake5
-rw-r--r--cmake/modules/FindZLIB.cmake8
4 files changed, 24 insertions, 3 deletions
diff --git a/cmake/modules/.editorconfig b/cmake/modules/.editorconfig
index e3d89f2549..993ca32026 100644
--- a/cmake/modules/.editorconfig
+++ b/cmake/modules/.editorconfig
@@ -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
diff --git a/cmake/modules/FindSMI.cmake b/cmake/modules/FindSMI.cmake
index 6c9d031fc4..0fe39735fe 100644
--- a/cmake/modules/FindSMI.cmake
+++ b/cmake/modules/FindSMI.cmake
@@ -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
diff --git a/cmake/modules/FindSPANDSP.cmake b/cmake/modules/FindSPANDSP.cmake
index 612304c09e..37c327cecb 100644
--- a/cmake/modules/FindSPANDSP.cmake
+++ b/cmake/modules/FindSPANDSP.cmake
@@ -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
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake
index 09c740597c..5fbe3eaa50 100644
--- a/cmake/modules/FindZLIB.cmake
+++ b/cmake/modules/FindZLIB.cmake
@@ -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