
This patch always defines the cxx_shared, cxx_static & other top-level targets. However, they are marked as EXCLUDE_FROM_ALL when we don't want to build them. Simply declaring the targets should be of no harm, and it allows other projects to mention these targets regardless of whether they end up being built or not. This patch basically moves the definition of e.g. cxx_shared out of the `if (LIBCXX_ENABLE_SHARED)` and instead marks it as EXCLUDE_FROM_ALL conditionally on whether LIBCXX_ENABLE_SHARED is passed. It then does the same for libunwind and libc++abi targets. I purposefully avoided to reformat the files (which now has inconsistent indentation) because I wanted to keep the diff minimal, and I know this is an area of the code where folks may have downstream diffs. I will re-indent the code separately once this patch lands. This is a reapplication of 79ee0342dbf0, which was reverted in a3539090884c because it broke the TSAN and the Fuchsia builds. Resolves #77654 Differential Revision: https://reviews.llvm.org/D134221
26 lines
1.4 KiB
CMake
26 lines
1.4 KiB
CMake
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
|
|
set(CMAKE_C_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "")
|
|
set(CMAKE_CXX_FLAGS "-D__LIBC_NO_CPP_MATH_OVERLOADS__" CACHE STRING "")
|
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-G -Wl,-bcdtors:all:-2147483548:s" CACHE STRING "")
|
|
set(CMAKE_AR "/usr/bin/ar" CACHE FILEPATH "")
|
|
|
|
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
|
|
set(LIBCXX_ABI_VERSION "1" CACHE STRING "")
|
|
set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "")
|
|
set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "")
|
|
set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
|
|
set(LIBCXXABI_ENABLE_SHARED ON CACHE BOOL "")
|
|
set(LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
|
|
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
|
|
set(LIBUNWIND_ENABLE_SHARED ON CACHE BOOL "")
|
|
set(LIBUNWIND_ENABLE_STATIC OFF CACHE BOOL "")
|
|
set(LIBCXX_ABI_DEFINES "_LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE" CACHE STRING "")
|
|
|
|
# On AIX, both shared and static libraries are archived. As a result, both the static and the shared targets end
|
|
# up with a `.a` suffix, which conflict. To workaround that, we set a different output name for the static
|
|
# libraries, which we never actually build anyway. For more information, see https://gitlab.kitware.com/cmake/cmake/-/issues/19494.
|
|
set(LIBCXX_STATIC_OUTPUT_NAME "c++-static" CACHE STRING "")
|
|
set(LIBCXXABI_STATIC_OUTPUT_NAME "c++abi-static" CACHE STRING "")
|
|
set(LIBUNWIND_STATIC_OUTPUT_NAME "unwind-static" CACHE STRING "")
|