Skip to content

Commit 245905d

Browse files
committed
[cmake] Allow for host libraries to be object libraries by letting add_swift_host_library take an OBJECT parameter.
1 parent 6b1b9ba commit 245905d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ endfunction()
389389
# add_swift_host_library(name
390390
# [SHARED]
391391
# [STATIC]
392+
# [OBJECT]
392393
# [LLVM_LINK_COMPONENTS comp1 ...]
393394
# source1 [source2 source3 ...])
394395
#
@@ -401,6 +402,9 @@ endfunction()
401402
# STATIC
402403
# Build a static library.
403404
#
405+
# OBJECT
406+
# Build an object library
407+
#
404408
# LLVM_LINK_COMPONENTS
405409
# LLVM components this library depends on.
406410
#
@@ -409,7 +413,8 @@ endfunction()
409413
function(add_swift_host_library name)
410414
set(options
411415
SHARED
412-
STATIC)
416+
STATIC
417+
OBJECT)
413418
set(single_parameter_options)
414419
set(multiple_parameter_options
415420
LLVM_LINK_COMPONENTS)
@@ -423,8 +428,8 @@ function(add_swift_host_library name)
423428
424429
translate_flags(ASHL "${options}")
425430
426-
if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
427-
message(FATAL_ERROR "Either SHARED or STATIC must be specified")
431+
if(NOT ASHL_SHARED AND NOT ASHL_STATIC AND NOT ASHL_OBJECT)
432+
message(FATAL_ERROR "One of SHARED/STATIC/OBJECT must be specified")
428433
endif()
429434
430435
if(XCODE)
@@ -449,6 +454,8 @@ function(add_swift_host_library name)
449454
set(libkind SHARED)
450455
elseif(ASHL_STATIC)
451456
set(libkind STATIC)
457+
elseif(ASHL_OBJECT)
458+
set(libkind OBJECT)
452459
endif()
453460
454461
add_library(${name} ${libkind} ${ASHL_SOURCES})

0 commit comments

Comments
 (0)