[libunwind] r300419 - [CMake][libunwind] Fix the -target and -gcc-toolchain flag handling

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 15 23:08:44 PDT 2017


Author: phosek
Date: Sun Apr 16 01:08:44 2017
New Revision: 300419

URL: http://llvm.org/viewvc/llvm-project?rev=300419&view=rev
Log:
[CMake][libunwind] Fix the -target and -gcc-toolchain flag handling

CMake has the problem with the single dash variant because of the
space, so use the double dash with equal sign version. The compile
flag handling had a typo which caused these flag not to be properly
include. We also don't have to pass the target triple when checking
for compiler-rt since that flag is already included in compile flags
now.

Differential Revision: https://reviews.llvm.org/D32071

Modified:
    libunwind/trunk/CMakeLists.txt
    libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake

Modified: libunwind/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=300419&r1=300418&r2=300419&view=diff
==============================================================================
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Sun Apr 16 01:08:44 2017
@@ -180,16 +180,16 @@ macro(add_target_flags_if condition var)
   if (${condition})
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${var}")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
-    list(APPEND LINUNWIND_COMPILE_FLAGS ${var})
+    list(APPEND LIBUNWIND_COMPILE_FLAGS ${var})
     list(APPEND LIBUNWIND_LINK_FLAGS ${var})
   endif()
 endmacro()
 
 add_target_flags_if(LIBUNWIND_BUILD_32_BITS "-m32")
 add_target_flags_if(LIBUNWIND_TARGET_TRIPLE
-          "-target ${LIBUNWIND_TARGET_TRIPLE}")
+          "--target=${LIBUNWIND_TARGET_TRIPLE}")
 add_target_flags_if(LIBUNWIND_GCC_TOOLCHAIN
-          "-gcc-toolchain ${LIBUNWIND_GCC_TOOLCHAIN}")
+          "--gcc-toolchain=${LIBUNWIND_GCC_TOOLCHAIN}")
 add_target_flags_if(LIBUNWIND_SYSROOT
           "--sysroot=${LIBUNWIND_SYSROOT}")
 

Modified: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=300419&r1=300418&r2=300419&view=diff
==============================================================================
--- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Sun Apr 16 01:08:44 2017
@@ -3,7 +3,7 @@ function(find_compiler_rt_library name d
     message(FATAL_ERROR "LIBUNWIND_COMPILE_FLAGS must be defined when using this function")
   endif()
   set(dest "" PARENT_SCOPE)
-  set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${TARGET_TRIPLE} ${LIBUNWIND_COMPILE_FLAGS}
+  set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS}
       "--rtlib=compiler-rt" "--print-libgcc-file-name")
   if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET)
     list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}")




More information about the cfe-commits mailing list