Skip to content

Commit 53a7cca

Browse files
committed
[cmake] Allow for add_swift_host_libraries to set that they shouldn't use llvm update flags.
This is specifically important for host libraries that include swift content. llvm_update_compile_flags currently doesn't conditionalize the flags it adds since it needs to be updated like I updated Swift's cmake in 558c9d4. In the short amount of time that I am dealing with upstream to patch those flags, this patch will unblock eeckstein and let him continue with his libswift work.
1 parent 245905d commit 53a7cca

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ endfunction()
390390
# [SHARED]
391391
# [STATIC]
392392
# [OBJECT]
393+
# [IGNORE_LLVM_UPDATE_COMPILE_FLAGS]
393394
# [LLVM_LINK_COMPONENTS comp1 ...]
394395
# source1 [source2 source3 ...])
395396
#
@@ -408,13 +409,19 @@ endfunction()
408409
# LLVM_LINK_COMPONENTS
409410
# LLVM components this library depends on.
410411
#
412+
# IGNORE_LLVM_UPDATE_COMPILE_FLAGS
413+
# If set do not use llvm_update_compile_flags to generate cflags/etc. This is
414+
# generally used when compiling a mixed c/c++/swift library and one wants to
415+
# disable this for the swift part.
416+
#
411417
# source1 ...
412418
# Sources to add into this library.
413419
function(add_swift_host_library name)
414420
set(options
415421
SHARED
416422
STATIC
417-
OBJECT)
423+
OBJECT
424+
IGNORE_LLVM_UPDATE_COMPILE_FLAGS)
418425
set(single_parameter_options)
419426
set(multiple_parameter_options
420427
LLVM_LINK_COMPONENTS)
@@ -460,7 +467,9 @@ function(add_swift_host_library name)
460467
461468
add_library(${name} ${libkind} ${ASHL_SOURCES})
462469
add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
463-
llvm_update_compile_flags(${name})
470+
if (NOT ASHL_IGNORE_LLVM_UPDATE_COMPILE_FLAGS)
471+
llvm_update_compile_flags(${name})
472+
endif()
464473
swift_common_llvm_config(${name} ${ASHL_LLVM_LINK_COMPONENTS})
465474
set_output_directory(${name}
466475
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}

0 commit comments

Comments
 (0)