Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prebuilt dependencies filenames on non-windows platforms #5848

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cmake/FetchedSharedLibrary.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(dep_shared_library_prefix "")
else()
set(dep_shared_library_prefix "lib")
endif()

# Helper function to download and extract an archive
function(download_and_extract archive_name url)
cmake_path(GET url FILENAME filename_with_ext)
Expand Down Expand Up @@ -57,7 +63,7 @@ function(copy_fetched_shared_library library_name url)
endif()

set(shared_library_filename
"${CMAKE_SHARED_LIBRARY_PREFIX}${library_name}${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${dep_shared_library_prefix}${library_name}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
macro(from_glob dir)
# A little helper function
Expand All @@ -82,7 +88,7 @@ function(copy_fetched_shared_library library_name url)
elseif(
url
MATCHES
"${CMAKE_SHARED_LIBRARY_PREFIX}.+${CMAKE_SHARED_LIBRARY_SUFFIX}$"
"${dep_shared_library_prefix}.+${CMAKE_SHARED_LIBRARY_SUFFIX}$"
AND EXISTS "${url}"
)
# Otherwise, if it's a direct path to a shared object, use that
Expand All @@ -105,7 +111,7 @@ function(copy_fetched_shared_library library_name url)

# We didn't find it, just return and don't create a target and operation
# which will fail
if(NOT EXISTS ${source_object} AND ARG_IGNORE_FAILURE)
if((NOT EXISTS "${source_object}") AND ARG_IGNORE_FAILURE)
return()
endif()

Expand Down Expand Up @@ -136,7 +142,7 @@ endfunction()
function(install_fetched_shared_library library_name url)
copy_fetched_shared_library(${library_name} ${url} ${ARGN})
set(shared_library_filename
"${CMAKE_SHARED_LIBRARY_PREFIX}${library_name}${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${dep_shared_library_prefix}${library_name}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
set(dest_object
${CMAKE_BINARY_DIR}/$<CONFIG>/${module_subdir}/${shared_library_filename}
Expand Down
Loading