1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-29 13:01:14 +03:00

cmake: normalize before matching paths with syspaths

Requires CMake 3.20:
https://cmake.org/cmake/help/latest/command/cmake_path.html

Co-authored-by: Kai Pastor
Ref: 307e1f9878
Closes #1538
This commit is contained in:
Viktor Szakats
2025-02-05 21:26:19 +01:00
parent eea97dbf0a
commit 9da0ca3cde

View File

@ -223,6 +223,9 @@ foreach(_libdir IN LISTS CMAKE_SYSTEM_PREFIX_PATH)
endforeach()
foreach(_libdir IN LISTS LIBSSH2_LIBDIRS)
if(NOT CMAKE_VERSION VERSION_LESS 3.20)
cmake_path(SET _libdir NORMALIZE "${_libdir}")
endif()
list(FIND _sys_libdirs "${_libdir}" _libdir_index)
if(_libdir_index LESS 0)
list(APPEND _ldflags "-L${_libdir}")
@ -257,6 +260,9 @@ foreach(_lib IN LISTS _implicit_libs LIBSSH2_LIBS)
get_filename_component(_libdir ${_lib} DIRECTORY)
get_filename_component(_libname ${_lib} NAME_WE)
if(_libname MATCHES "^lib")
if(NOT CMAKE_VERSION VERSION_LESS 3.20)
cmake_path(SET _libdir NORMALIZE "${_libdir}")
endif()
list(FIND _sys_libdirs "${_libdir}" _libdir_index)
if(_libdir_index LESS 0)
list(APPEND _ldflags "-L${_libdir}")