Skip to content

Instantly share code, notes, and snippets.

@niw
Created May 21, 2018 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niw/ef33733d3781986cd28f31f41f1a45c2 to your computer and use it in GitHub Desktop.
Save niw/ef33733d3781986cd28f31f41f1a45c2 to your computer and use it in GitHub Desktop.
LLVM and Clang linker flag arguments should be quoted.
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index fd5627eec..4ac6d6225 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -73,7 +73,7 @@ function(add_llvm_symbol_exports target_name export_file)
VERBATIM
COMMENT "Creating export file for ${target_name}")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
- LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
+ LINK_FLAGS " -Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-bE:${export_file}")
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index a524c70d..452ea4ef 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -90,7 +90,7 @@ if (APPLE)
set(TOOL_INFO_PLIST_OUT "${CMAKE_CURRENT_BINARY_DIR}/${TOOL_INFO_PLIST}")
target_link_libraries(clang
PRIVATE
- "-Wl,-sectcreate,__TEXT,__info_plist,${TOOL_INFO_PLIST_OUT}")
+ "-Wl,-sectcreate,__TEXT,__info_plist,\"${TOOL_INFO_PLIST_OUT}\"")
configure_file("${TOOL_INFO_PLIST}.in" "${TOOL_INFO_PLIST_OUT}" @ONLY)
set(TOOL_INFO_UTI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment