[libcxxabi] r300418 - [CMake][libcxxabi] Fix the -target and -gcc-toolchain flag handling

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


Author: phosek
Date: Sun Apr 16 01:08:34 2017
New Revision: 300418

URL: http://llvm.org/viewvc/llvm-project?rev=300418&view=rev
Log:
[CMake][libcxxabi] 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. These flag
need to be included in compile flags to propagate correctly. 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/D32069

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

Modified: libcxxabi/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=300418&r1=300417&r2=300418&view=diff
==============================================================================
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Sun Apr 16 01:08:34 2017
@@ -275,6 +275,7 @@ 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 LIBCXXABI_COMPILE_FLAGS ${var})
     list(APPEND LIBCXXABI_LINK_FLAGS ${var})
   endif()
 endmacro()
@@ -287,9 +288,9 @@ set(LIBCXXABI_LINK_FLAGS "")
 # Configure target flags
 add_target_flags_if(LIBCXXABI_BUILD_32_BITS "-m32")
 add_target_flags_if(LIBCXXABI_TARGET_TRIPLE
-          "-target ${LIBCXXABI_TARGET_TRIPLE}")
+          "--target=${LIBCXXABI_TARGET_TRIPLE}")
 add_target_flags_if(LIBCXXABI_GCC_TOOLCHAIN
-         "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
+         "--gcc-toolchain=${LIBCXXABI_GCC_TOOLCHAIN}")
 add_target_flags_if(LIBCXXABI_SYSROOT
           "--sysroot=${LIBCXXABI_SYSROOT}")
 

Modified: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=300418&r1=300417&r2=300418&view=diff
==============================================================================
--- libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake Sun Apr 16 01:08:34 2017
@@ -3,7 +3,7 @@ function(find_compiler_rt_library name d
     message(FATAL_ERROR "LIBCXXABI_COMPILE_FLAGS must be defined when using this function")
   endif()
   set(dest "" PARENT_SCOPE)
-  set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${TARGET_TRIPLE} ${LIBCXXABI_COMPILE_FLAGS}
+  set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_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