diff options
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/AddCompilerRT.cmake | 12 | ||||
-rw-r--r-- | cmake/Modules/CompilerRTDarwinUtils.cmake | 2 | ||||
-rw-r--r-- | cmake/Modules/CompilerRTLink.cmake | 6 | ||||
-rw-r--r-- | cmake/Modules/CompilerRTUtils.cmake | 16 | ||||
-rw-r--r-- | cmake/Modules/SanitizerUtils.cmake | 8 |
5 files changed, 27 insertions, 17 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake index c2863d5f2f8c..3c1e1c10d2af 100644 --- a/cmake/Modules/AddCompilerRT.cmake +++ b/cmake/Modules/AddCompilerRT.cmake @@ -94,7 +94,7 @@ endfunction() # OS <os list> # SOURCES <source files> # CFLAGS <compile flags> -# LINKFLAGS <linker flags> +# LINK_FLAGS <linker flags> # DEFS <compile definitions> # LINK_LIBS <linked libraries> (only for shared library) # OBJECT_LIBS <object libraries to use as sources> @@ -107,7 +107,7 @@ function(add_compiler_rt_runtime name type) cmake_parse_arguments(LIB "" "PARENT_TARGET" - "OS;ARCHS;SOURCES;CFLAGS;LINKFLAGS;DEFS;LINK_LIBS;OBJECT_LIBS" + "OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;LINK_LIBS;OBJECT_LIBS" ${ARGN}) set(libnames) if(APPLE) @@ -116,7 +116,7 @@ function(add_compiler_rt_runtime name type) set(libname "${name}_${os}") else() set(libname "${name}_${os}_dynamic") - set(extra_linkflags_${libname} ${DARWIN_${os}_LINKFLAGS} ${LIB_LINKFLAGS}) + set(extra_link_flags_${libname} ${DARWIN_${os}_LINK_FLAGS} ${LIB_LINK_FLAGS}) endif() list_intersect(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS) if(LIB_ARCHS_${libname}) @@ -139,7 +139,7 @@ function(add_compiler_rt_runtime name type) else() set(libname "${name}-dynamic-${arch}") set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS}) - set(extra_linkflags_${libname} ${TARGET_${arch}_LINKFLAGS} ${LIB_LINKFLAGS}) + set(extra_link_flags_${libname} ${TARGET_${arch}_LINK_FLAGS} ${LIB_LINK_FLAGS}) if(WIN32) set(output_name_${libname} ${name}_dynamic-${arch}${COMPILER_RT_OS_SUFFIX}) else() @@ -188,7 +188,7 @@ function(add_compiler_rt_runtime name type) add_library(${libname} ${type} ${sources_${libname}}) set_target_compile_flags(${libname} ${extra_cflags_${libname}}) - set_target_link_flags(${libname} ${extra_linkflags_${libname}}) + set_target_link_flags(${libname} ${extra_link_flags_${libname}}) set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS ${LIB_DEFS}) set_target_output_directories(${libname} ${COMPILER_RT_LIBRARY_OUTPUT_DIR}) @@ -243,7 +243,7 @@ endfunction() # when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help # in compilation and linking of unittests. string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}") -set(COMPILER_RT_UNITTEST_LINKFLAGS ${COMPILER_RT_UNITTEST_CFLAGS}) +set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS}) # Unittests support. set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest) diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake index 28d398672121..3c89381f92f9 100644 --- a/cmake/Modules/CompilerRTDarwinUtils.cmake +++ b/cmake/Modules/CompilerRTDarwinUtils.cmake @@ -66,7 +66,7 @@ function(darwin_test_archs os valid_archs) file(WRITE ${SIMPLE_C} "#include <stdio.h>\nint main() { printf(__FILE__); return 0; }\n") set(os_linker_flags) - foreach(flag ${DARWIN_${os}_LINKFLAGS}) + foreach(flag ${DARWIN_${os}_LINK_FLAGS}) set(os_linker_flags "${os_linker_flags} ${flag}") endforeach() endif() diff --git a/cmake/Modules/CompilerRTLink.cmake b/cmake/Modules/CompilerRTLink.cmake index bb96869844c1..05c535f623b3 100644 --- a/cmake/Modules/CompilerRTLink.cmake +++ b/cmake/Modules/CompilerRTLink.cmake @@ -1,16 +1,16 @@ # Link a shared library with COMPILER_RT_TEST_COMPILER. # clang_link_shared(<output.so> # OBJECTS <list of input objects> -# LINKFLAGS <list of link flags> +# LINK_FLAGS <list of link flags> # DEPS <list of dependencies>) macro(clang_link_shared so_file) - cmake_parse_arguments(SOURCE "" "" "OBJECTS;LINKFLAGS;DEPS" ${ARGN}) + cmake_parse_arguments(SOURCE "" "" "OBJECTS;LINK_FLAGS;DEPS" ${ARGN}) if(NOT COMPILER_RT_STANDALONE_BUILD) list(APPEND SOURCE_DEPS clang) endif() add_custom_command( OUTPUT ${so_file} COMMAND ${COMPILER_RT_TEST_COMPILER} -o "${so_file}" -shared - ${SOURCE_LINKFLAGS} ${SOURCE_OBJECTS} + ${SOURCE_LINK_FLAGS} ${SOURCE_OBJECTS} DEPENDS ${SOURCE_DEPS}) endmacro() diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index cedaaeeb3580..c337523cd944 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -126,7 +126,7 @@ endfunction() # If successful, saves target flags for this architecture. macro(test_target_arch arch def) set(TARGET_${arch}_CFLAGS ${ARGN}) - set(TARGET_${arch}_LINKFLAGS ${ARGN}) + set(TARGET_${arch}_LINK_FLAGS ${ARGN}) set(argstring "") foreach(arg ${ARGN}) set(argstring "${argstring} ${arg}") @@ -219,8 +219,18 @@ macro(load_llvm_config) set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") # Make use of LLVM CMake modules. - file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) - set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + # --cmakedir is supported since llvm r291218 (4.0 release) + execute_process( + COMMAND ${LLVM_CONFIG_PATH} --cmakedir + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE CONFIG_OUTPUT) + if(NOT HAD_ERROR) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + else() + file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + endif() + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") # Get some LLVM variables from LLVMConfig. include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake") diff --git a/cmake/Modules/SanitizerUtils.cmake b/cmake/Modules/SanitizerUtils.cmake index 3e1a6346e12a..c80fc3b1eefc 100644 --- a/cmake/Modules/SanitizerUtils.cmake +++ b/cmake/Modules/SanitizerUtils.cmake @@ -48,13 +48,13 @@ endmacro() # This function is only used on Darwin, where undefined symbols must be specified # in the linker invocation. -function(add_weak_symbols libname linkflags) +function(add_weak_symbols libname link_flags) file(STRINGS "${COMPILER_RT_SOURCE_DIR}/lib/${libname}/weak_symbols.txt" WEAK_SYMBOLS) - set(local_linkflags ${${linkflags}}) + set(local_link_flags ${${link_flags}}) foreach(SYMBOL ${WEAK_SYMBOLS}) - set(local_linkflags ${local_linkflags} -Wl,-U,${SYMBOL}) + set(local_link_flags ${local_link_flags} -Wl,-U,${SYMBOL}) endforeach() - set(${linkflags} ${local_linkflags} PARENT_SCOPE) + set(${link_flags} ${local_link_flags} PARENT_SCOPE) endfunction() macro(add_sanitizer_rt_version_list name) |