diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -272,9 +272,6 @@ # Target options -------------------------------------------------------------- option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS}) -set(LIBCXX_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Use alternate target triple.") -set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.") -set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.") # Feature options ------------------------------------------------------------- option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON) @@ -487,22 +484,6 @@ # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS' add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32") -if(LIBCXX_TARGET_TRIPLE) - add_target_flags_if_supported("--target=${LIBCXX_TARGET_TRIPLE}") -elseif(CMAKE_CXX_COMPILER_TARGET) - set(LIBCXX_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}") -endif() -if(LIBCXX_SYSROOT) - add_target_flags_if_supported("--sysroot=${LIBCXX_SYSROOT}") -elseif(CMAKE_SYSROOT) - set(LIBCXX_SYSROOT "${CMAKE_SYSROOT}") -endif() -if(LIBCXX_GCC_TOOLCHAIN) - add_target_flags_if_supported("--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") -elseif(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - set(LIBCXX_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") -endif() - # Configure compiler. include(config-ix) diff --git a/libcxx/cmake/caches/AArch64.cmake b/libcxx/cmake/caches/AArch64.cmake --- a/libcxx/cmake/caches/AArch64.cmake +++ b/libcxx/cmake/caches/AArch64.cmake @@ -1,2 +1,2 @@ set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") -set(LIBCXX_TARGET_TRIPLE "aarch64-linux-gnu" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu" CACHE STRING "") diff --git a/libcxx/cmake/caches/Armv7Arm.cmake b/libcxx/cmake/caches/Armv7Arm.cmake --- a/libcxx/cmake/caches/Armv7Arm.cmake +++ b/libcxx/cmake/caches/Armv7Arm.cmake @@ -1,4 +1,4 @@ set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") -set(LIBCXX_TARGET_TRIPLE "armv7-linux-gnueabihf" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET "armv7-linux-gnueabihf" CACHE STRING "") set(CMAKE_CXX_FLAGS "-marm" CACHE STRING "") set(CMAKE_C_FLAGS "-marm" CACHE STRING "") diff --git a/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake b/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake --- a/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake +++ b/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake @@ -1,5 +1,5 @@ set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") -set(LIBCXX_TARGET_TRIPLE "armv7-linux-gnueabihf" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET "armv7-linux-gnueabihf" CACHE STRING "") set(CMAKE_CXX_FLAGS "-mthumb" CACHE STRING "") set(CMAKE_C_FLAGS "-mthumb" CACHE STRING "") set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") diff --git a/libcxx/cmake/caches/Armv8Arm.cmake b/libcxx/cmake/caches/Armv8Arm.cmake --- a/libcxx/cmake/caches/Armv8Arm.cmake +++ b/libcxx/cmake/caches/Armv8Arm.cmake @@ -1,4 +1,4 @@ set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") -set(LIBCXX_TARGET_TRIPLE "armv8-linux-gnueabihf" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET "armv8-linux-gnueabihf" CACHE STRING "") set(CMAKE_CXX_FLAGS "-marm" CACHE STRING "") set(CMAKE_C_FLAGS "-marm" CACHE STRING "") diff --git a/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake b/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake --- a/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake +++ b/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake @@ -1,5 +1,5 @@ set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") -set(LIBCXX_TARGET_TRIPLE "armv8-linux-gnueabihf" CACHE STRING "") +set(CMAKE_CXX_COMPILER_TARGET "armv8-linux-gnueabihf" CACHE STRING "") set(CMAKE_CXX_FLAGS "-mthumb" CACHE STRING "") set(CMAKE_C_FLAGS "-mthumb" CACHE STRING "") set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -136,7 +136,7 @@ If you are running in an MSYS2 shell and you have installed the MSYS2-provided clang package (which defaults to a non-MSVC target), you -should add e.g. ``-DLIBCXX_TARGET_TRIPLE=x86_64-windows-msvc`` (replacing +should add e.g. ``-DCMAKE_CXX_COMPILER_TARGET=x86_64-windows-msvc`` (replacing ``x86_64`` with the architecture you're targeting) to the ``cmake`` command line above. This will instruct ``check-cxx`` to use the right target triple when invoking ``clang++``. diff --git a/libcxx/lib/abi/CMakeLists.txt b/libcxx/lib/abi/CMakeLists.txt --- a/libcxx/lib/abi/CMakeLists.txt +++ b/libcxx/lib/abi/CMakeLists.txt @@ -41,7 +41,7 @@ endfunction() cxx_abi_list_identifier(abi_list_identifier - "${LIBCXX_TARGET_TRIPLE}" + "${CMAKE_CXX_COMPILER_TARGET}" "${LIBCXX_CXX_ABI_LIBNAME}" "${LIBCXX_ABI_VERSION}" "${LIBCXX_ABI_UNSTABLE}" diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -105,8 +105,8 @@ serialize_lit_param(enable_debug_tests False) endif() -if (LIBCXX_TARGET_TRIPLE) - serialize_lit_param(target_triple "\"${LIBCXX_TARGET_TRIPLE}\"") +if (CMAKE_CXX_COMPILER_TARGET) + serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"") endif() if (LLVM_USE_SANITIZER) diff --git a/libcxx/test/configs/legacy.cfg.in b/libcxx/test/configs/legacy.cfg.in --- a/libcxx/test/configs/legacy.cfg.in +++ b/libcxx/test/configs/legacy.cfg.in @@ -17,8 +17,8 @@ config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@" config.configuration_variant = "@LIBCXX_LIT_VARIANT@" config.host_triple = "@LLVM_HOST_TRIPLE@" -config.sysroot = "@LIBCXX_SYSROOT@" -config.gcc_toolchain = "@LIBCXX_GCC_TOOLCHAIN@" +config.sysroot = "@CMAKE_SYSROOT@" +config.gcc_toolchain = "@CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN@" config.generate_coverage = @LIBCXX_GENERATE_COVERAGE@ config.target_info = "@LIBCXX_TARGET_INFO@" config.test_linker_flags = "@LIBCXX_TEST_LINKER_FLAGS@" diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -113,9 +113,6 @@ set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "Define suffix of library directory name (32/64)") option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON) -set(LIBCXXABI_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.") -set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.") -set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.") set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.") set(LIBCXXABI_LIBRARY_VERSION "1.0" CACHE STRING "Version of libc++abi. This will be reflected in the name of the shared \ @@ -269,22 +266,6 @@ # Configure target flags add_target_flags_if(LIBCXXABI_BUILD_32_BITS "-m32") -if(LIBCXXABI_TARGET_TRIPLE) - add_target_flags_if_supported("--target=${LIBCXXABI_TARGET_TRIPLE}") -elseif(CMAKE_CXX_COMPILER_TARGET) - set(LIBCXXABI_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}") -endif() -if(LIBCXX_GCC_TOOLCHAIN) - add_target_flags_if_supported("--gcc-toolchain=${LIBCXXABI_GCC_TOOLCHAIN}") -elseif(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - set(LIBCXXABI_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") -endif() -if(LIBCXXABI_SYSROOT) - add_target_flags_if_supported("--sysroot=${LIBCXXABI_SYSROOT}") -elseif(CMAKE_SYSROOT) - set(LIBCXXABI_SYSROOT "${CMAKE_SYSROOT}") -endif() - # Configure compiler. Must happen after setting the target flags. include(config-ix) diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt --- a/libcxxabi/test/CMakeLists.txt +++ b/libcxxabi/test/CMakeLists.txt @@ -86,8 +86,8 @@ serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"") endif() -if (LIBCXXABI_TARGET_TRIPLE) - serialize_lit_param(target_triple "\"${LIBCXXABI_TARGET_TRIPLE}\"") +if (CMAKE_CXX_COMPILER_TARGET) + serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"") endif() if (LIBCXXABI_BUILD_32_BITS) diff --git a/libcxxabi/test/lit.site.cfg.in b/libcxxabi/test/lit.site.cfg.in --- a/libcxxabi/test/lit.site.cfg.in +++ b/libcxxabi/test/lit.site.cfg.in @@ -24,8 +24,8 @@ config.libcxxabi_shared = @LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI@ config.enable_shared = @LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX@ config.host_triple = "@LLVM_HOST_TRIPLE@" -config.sysroot = "@LIBCXXABI_SYSROOT@" -config.gcc_toolchain = "@LIBCXXABI_GCC_TOOLCHAIN@" +config.sysroot = "@CMAKE_SYSROOT@" +config.gcc_toolchain = "@CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN@" config.cxx_ext_threads = @LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY@ config.pstl_src_root = "@ParallelSTL_SOURCE_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -80,9 +80,6 @@ cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY "Install the shared libunwind library." ON "LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF) -set(LIBUNWIND_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE STRING "Target triple for cross compiling.") -set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.") -set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.") set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING "Additional linker flags for test programs.") set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING @@ -174,22 +171,6 @@ # Get required flags. add_target_flags_if(LIBUNWIND_BUILD_32_BITS "-m32") -if(LIBUNWIND_TARGET_TRIPLE) - add_target_flags_if_supported("--target=${LIBUNWIND_TARGET_TRIPLE}") -elseif(CMAKE_CXX_COMPILER_TARGET) - set(LIBUNWIND_TARGET_TRIPLE "${CMAKE_CXX_COMPILER_TARGET}") -endif() -if(LIBUNWIND_GCC_TOOLCHAIN) - add_target_flags_if_supported("--gcc-toolchain=${LIBUNWIND_GCC_TOOLCHAIN}") -elseif(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - set(LIBUNWIND_GCC_TOOLCHAIN "${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") -endif() -if(LIBUNWIND_SYSROOT) - add_target_flags_if_supported("--sysroot=${LIBUNWIND_SYSROOT}") -elseif(CMAKE_SYSROOT) - set(LIBUNWIND_SYSROOT "${CMAKE_SYSROOT}") -endif() - # Configure compiler. include(config-ix) diff --git a/libunwind/docs/BuildingLibunwind.rst b/libunwind/docs/BuildingLibunwind.rst --- a/libunwind/docs/BuildingLibunwind.rst +++ b/libunwind/docs/BuildingLibunwind.rst @@ -148,18 +148,6 @@ Build libunwind with threading support. -.. option:: LIBUNWIND_TARGET_TRIPLE:STRING - - Target triple for cross compiling - -.. option:: LIBUNWIND_GCC_TOOLCHAIN:PATH - - GCC toolchain for cross compiling - -.. option:: LIBUNWIND_SYSROOT - - Sysroot for cross compiling - .. option:: LIBUNWIND_INSTALL_LIBRARY_DIR:PATH **Default**: ``lib${LIBUNWIND_LIBDIR_SUFFIX}`` diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -37,8 +37,8 @@ serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"") endif() -if (LIBUNWIND_TARGET_TRIPLE) - serialize_lit_param(target_triple "\"${LIBUNWIND_TARGET_TRIPLE}\"") +if (CMAKE_CXX_COMPILER_TARGET) + serialize_lit_param(target_triple "\"${CMAKE_CXX_COMPILER_TARGET}\"") endif() if (LIBUNWIND_BUILD_32_BITS) diff --git a/libunwind/test/lit.site.cfg.in b/libunwind/test/lit.site.cfg.in --- a/libunwind/test/lit.site.cfg.in +++ b/libunwind/test/lit.site.cfg.in @@ -25,8 +25,8 @@ config.enable_shared = @LIBCXX_ENABLE_SHARED@ config.arm_ehabi = @LIBUNWIND_USES_ARM_EHABI@ config.host_triple = "@LLVM_HOST_TRIPLE@" -config.sysroot = "@LIBUNWIND_SYSROOT@" -config.gcc_toolchain = "@LIBUNWIND_GCC_TOOLCHAIN@" +config.sysroot = "@CMAKE_SYSROOT@" +config.gcc_toolchain = "@CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN@" config.cxx_ext_threads = @LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY@ config.x86_cet = @LIBUNWIND_ENABLE_CET@