File tree Expand file tree Collapse file tree 4 files changed +32
-6
lines changed Expand file tree Collapse file tree 4 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,8 @@ set(LLVM_ENABLE_ZLIB "ON" CACHE STRING "Use zlib for compression/decompression i
446
446
447
447
set (LLVM_ENABLE_ZSTD "ON" CACHE STRING "Use zstd for compression/decompression if available. Can be ON, OFF, or FORCE_ON" )
448
448
449
+ set (LLVM_PREFER_STATIC_ZSTD TRUE CACHE BOOL "Use static version of zstd if available. Can be TRUE, FALSE" )
450
+
449
451
set (LLVM_ENABLE_CURL "OFF" CACHE STRING "Use libcurl for the HTTP client if available. Can be ON, OFF, or FORCE_ON" )
450
452
451
453
set (LLVM_ENABLE_HTTPLIB "OFF" CACHE STRING "Use cpp-httplib HTTP server library if available. Can be ON, OFF, or FORCE_ON" )
Original file line number Diff line number Diff line change @@ -75,7 +75,6 @@ endif()
75
75
76
76
set (LLVM_ENABLE_ZSTD @LLVM_ENABLE_ZSTD@ )
77
77
if (LLVM_ENABLE_ZSTD )
78
- set (zstd_ROOT @zstd_ROOT@ )
79
78
find_package (zstd )
80
79
endif ()
81
80
Original file line number Diff line number Diff line change @@ -22,11 +22,29 @@ if (HAS_WERROR_GLOBAL_CTORS)
22
22
endif ()
23
23
24
24
if (LLVM_ENABLE_ZLIB )
25
- set (imported_libs ZLIB::ZLIB )
25
+ list (APPEND imported_libs ZLIB::ZLIB )
26
+ endif ()
27
+
28
+ set (zstd_target none )
29
+
30
+ if (LLVM_ENABLE_ZSTD )
31
+ if (LLVM_PREFER_STATIC_ZSTD )
32
+ if (TARGET zstd::libzstd_static )
33
+ set (zstd_target zstd::libzstd_static )
34
+ else ()
35
+ set (zstd_target zstd::libzstd_shared )
36
+ endif ()
37
+ else ()
38
+ if (TARGET zstd::libzstd_shared )
39
+ set (zstd_target zstd::libzstd_shared )
40
+ else ()
41
+ set (zstd_target zstd::libzstd_static )
42
+ endif ()
43
+ endif ()
26
44
endif ()
27
45
28
46
if (LLVM_ENABLE_ZSTD )
29
- list (APPEND imported_libs zstd::libzstd_shared )
47
+ list (APPEND imported_libs ${zstd_target} )
30
48
endif ()
31
49
32
50
if ( MSVC OR MINGW )
@@ -300,11 +318,12 @@ if(LLVM_ENABLE_ZSTD)
300
318
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
301
319
if (CMAKE_BUILD_TYPE )
302
320
string (TOUPPER ${CMAKE_BUILD_TYPE} build_type )
303
- get_property (zstd_library TARGET zstd::libzstd_shared PROPERTY LOCATION_${build_type} )
321
+ get_property (zstd_library TARGET ${zstd_target} PROPERTY LOCATION_${build_type} )
304
322
endif ()
305
323
if (NOT zstd_library )
306
- get_property (zstd_library TARGET zstd::libzstd_shared PROPERTY LOCATION )
324
+ get_property (zstd_library TARGET ${zstd_target} PROPERTY LOCATION )
307
325
endif ()
326
+ get_library_name (${zstd_library} zstd_library )
308
327
set (llvm_system_libs ${llvm_system_libs} "${zstd_library} " )
309
328
endif ()
310
329
Original file line number Diff line number Diff line change @@ -17,9 +17,14 @@ add_llvm_tool(llvm-config
17
17
# Compute the substitution values for various items.
18
18
get_property (SUPPORT_SYSTEM_LIBS TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS )
19
19
get_property (WINDOWSMANIFEST_SYSTEM_LIBS TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS )
20
+
20
21
foreach (l ${SUPPORT_SYSTEM_LIBS} ${WINDOWSMANIFEST_SYSTEM_LIBS} )
21
22
if (MSVC )
22
- set (SYSTEM_LIBS ${SYSTEM_LIBS} "${l} .lib" )
23
+ if (IS_ABSOLUTE ${l} )
24
+ set (SYSTEM_LIBS ${SYSTEM_LIBS} "${l} " )
25
+ else ()
26
+ set (SYSTEM_LIBS ${SYSTEM_LIBS} "${l} .lib" )
27
+ endif ()
23
28
else ()
24
29
if (l MATCHES "^-" )
25
30
# If it's an option, pass it without changes.
@@ -34,6 +39,7 @@ foreach(l ${SUPPORT_SYSTEM_LIBS} ${WINDOWSMANIFEST_SYSTEM_LIBS})
34
39
endif ()
35
40
endif ()
36
41
endforeach ()
42
+
37
43
string (REPLACE ";" " " SYSTEM_LIBS "${SYSTEM_LIBS} " )
38
44
39
45
# Fetch target specific compile options, e.g. RTTI option
You can’t perform that action at this time.
0 commit comments