Home | History | Annotate | Download | only in llvm-libc++abi
      1 # See www/CMake.html for instructions on how to build libcxxabi with CMake.
      2 
      3 #===============================================================================
      4 # Setup Project
      5 #===============================================================================
      6 
      7 cmake_minimum_required(VERSION 3.4.3)
      8 
      9 if(POLICY CMP0042)
     10   cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
     11 endif()
     12 
     13 # Add path for custom modules
     14 set(CMAKE_MODULE_PATH
     15   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
     16   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
     17   ${CMAKE_MODULE_PATH}
     18   )
     19 
     20 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
     21   project(libcxxabi CXX C)
     22 
     23   set(PACKAGE_NAME libcxxabi)
     24   set(PACKAGE_VERSION 6.0.0svn)
     25   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
     26   set(PACKAGE_BUGREPORT "llvm-bugs (a] lists.llvm.org")
     27 
     28   # Find the LLVM sources and simulate LLVM CMake options.
     29   include(HandleOutOfTreeLLVM)
     30 endif()
     31 
     32 # Require out of source build.
     33 include(MacroEnsureOutOfSourceBuild)
     34 MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
     35  "${PROJECT_NAME} requires an out of source build. Please create a separate
     36  build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
     37  )
     38 
     39 #===============================================================================
     40 # Setup CMake Options
     41 #===============================================================================
     42 include(CMakeDependentOption)
     43 include(HandleCompilerRT)
     44 
     45 # Define options.
     46 option(LIBCXXABI_ENABLE_EXCEPTIONS "Use exceptions." ON)
     47 option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
     48 option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
     49 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
     50 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
     51 option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)
     52 option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
     53 option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
     54 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
     55 option(LIBCXXABI_HAS_EXTERNAL_THREAD_API
     56   "Build libc++abi with an externalized threading API.
     57   This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON." OFF)
     58 option(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY
     59   "Build libc++abi with an externalized threading library.
     60    This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON" OFF)
     61 
     62 # FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link
     63 # programs to due undefined references to new/delete in libc++abi. Once this
     64 # has been fixed or worked around the default value should be changed.
     65 option(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
     66     "Build libc++abi with definitions for operator new/delete. Normally libc++
     67     provides these definitions" ON)
     68 option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS})
     69 option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
     70 set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
     71     "Define suffix of library directory name (32/64)")
     72 set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
     73 set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
     74 set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
     75 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
     76 
     77 # Default to building a shared library so that the default options still test
     78 # the libc++abi that is being built. There are two problems with testing a
     79 # static libc++abi. In the case of a standalone build, the tests will link the
     80 # system's libc++, which might not have been built against our libc++abi. In the
     81 # case of an in tree build, libc++ will prefer a dynamic libc++abi from the
     82 # system over a static libc++abi from the output directory.
     83 option(LIBCXXABI_ENABLE_SHARED "Build libc++abi as a shared library." ON)
     84 option(LIBCXXABI_ENABLE_STATIC "Build libc++abi as a static library." ON)
     85 
     86 option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF)
     87 # The default terminate handler attempts to demangle uncaught exceptions, which
     88 # causes extra I/O and demangling code to be pulled in.
     89 option(LIBCXXABI_SILENT_TERMINATE "Set this to make the terminate handler default to a silent alternative" OFF)
     90 
     91 if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC)
     92   message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
     93 endif()
     94 
     95 if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR)
     96   set(LIBCXXABI_LIBCXX_SRC_DIRS ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
     97 else()
     98   set(LIBCXXABI_LIBCXX_SRC_DIRS
     99     "${LLVM_MAIN_SRC_DIR}/projects/libcxx"
    100     "${LLVM_MAIN_SRC_DIR}/runtimes/libcxx"
    101     )
    102 endif()
    103 
    104 set(LIBCXXABI_LIBCXX_INCLUDE_DIRS "")
    105 foreach(dir ${LIBCXXABI_LIBCXX_SRC_DIRS})
    106   list(APPEND LIBCXXABI_LIBCXX_INCLUDE_DIRS "${dir}/include")
    107 endforeach()
    108 
    109 find_path(
    110   LIBCXXABI_LIBCXX_INCLUDES
    111   vector
    112   PATHS ${LIBCXXABI_LIBCXX_INCLUDES}
    113         ${LIBCXXABI_LIBCXX_PATH}/include
    114         ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES}
    115         ${LIBCXXABI_LIBCXX_INCLUDE_DIRS}
    116         ${LLVM_INCLUDE_DIR}/c++/v1
    117   )
    118 
    119 set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH
    120     "Specify path to libc++ includes." FORCE)
    121 
    122 find_path(
    123   LIBCXXABI_LIBCXX_PATH
    124   utils/libcxx/test/__init__.py
    125   PATHS ${LIBCXXABI_LIBCXX_PATH}
    126         ${LIBCXXABI_LIBCXX_INCLUDES}/../
    127         ${LIBCXXABI_LIBCXX_SRC_DIRS}
    128   NO_DEFAULT_PATH
    129   )
    130 
    131 if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND")
    132   message(WARNING "LIBCXXABI_LIBCXX_PATH was not specified and couldn't be infered.")
    133   set(LIBCXXABI_LIBCXX_PATH "")
    134 endif()
    135 
    136 set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH
    137     "Specify path to libc++ source." FORCE)
    138 
    139 #===============================================================================
    140 # Configure System
    141 #===============================================================================
    142 
    143 # Add path for custom modules
    144 set(CMAKE_MODULE_PATH
    145   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
    146   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
    147   ${CMAKE_MODULE_PATH}
    148   )
    149 
    150 set(LIBCXXABI_COMPILER    ${CMAKE_CXX_COMPILER})
    151 set(LIBCXXABI_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
    152 set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
    153 if (LLVM_LIBRARY_OUTPUT_INTDIR)
    154   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
    155 else()
    156   set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
    157 endif()
    158 
    159 set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING
    160     "Define libc++abi destination prefix.")
    161 
    162 if (NOT LIBCXXABI_INSTALL_PREFIX MATCHES "^$|.*/")
    163   message(FATAL_ERROR "LIBCXXABI_INSTALL_PREFIX has to end with \"/\".")
    164 endif()
    165 
    166 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
    167 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
    168 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
    169 
    170 # By default, for non-standalone builds, libcxx and libcxxabi share a library
    171 # directory.
    172 if (NOT LIBCXXABI_LIBCXX_LIBRARY_PATH)
    173   set(LIBCXXABI_LIBCXX_LIBRARY_PATH "${LIBCXXABI_LIBRARY_DIR}" CACHE PATH
    174       "The path to libc++ library.")
    175 endif()
    176 
    177 # Check that we can build with 32 bits if requested.
    178 if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
    179   if (LIBCXXABI_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
    180     message(STATUS "Building 32 bits executables and libraries.")
    181   endif()
    182 elseif(LIBCXXABI_BUILD_32_BITS)
    183   message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS=ON is not supported on this platform.")
    184 endif()
    185 
    186 # Declare libc++abi configuration variables.
    187 # They are intended for use as follows:
    188 # LIBCXXABI_C_FLAGS: General flags for both the c++ compiler and linker.
    189 # LIBCXXABI_CXX_FLAGS: General flags for both the c++ compiler and linker.
    190 # LIBCXXABI_COMPILE_FLAGS: Compile only flags.
    191 # LIBCXXABI_LINK_FLAGS: Linker only flags.
    192 # LIBCXXABI_LIBRARIES: libraries libc++abi is linked to.
    193 
    194 set(LIBCXXABI_C_FLAGS "")
    195 set(LIBCXXABI_CXX_FLAGS "")
    196 set(LIBCXXABI_COMPILE_FLAGS "")
    197 set(LIBCXXABI_LINK_FLAGS "")
    198 set(LIBCXXABI_LIBRARIES "")
    199 
    200 # Include macros for adding and removing libc++abi flags.
    201 include(HandleLibcxxabiFlags)
    202 
    203 #===============================================================================
    204 # Setup Compiler Flags
    205 #===============================================================================
    206 
    207 # Configure target flags
    208 add_target_flags_if(LIBCXXABI_BUILD_32_BITS "-m32")
    209 add_target_flags_if(LIBCXXABI_TARGET_TRIPLE
    210           "--target=${LIBCXXABI_TARGET_TRIPLE}")
    211 add_target_flags_if(LIBCXXABI_GCC_TOOLCHAIN
    212          "--gcc-toolchain=${LIBCXXABI_GCC_TOOLCHAIN}")
    213 add_target_flags_if(LIBCXXABI_SYSROOT
    214           "--sysroot=${LIBCXXABI_SYSROOT}")
    215 
    216 if (LIBCXXABI_TARGET_TRIPLE)
    217   set(TARGET_TRIPLE "${LIBCXXABI_TARGET_TRIPLE}")
    218 endif()
    219 
    220 # Configure compiler. Must happen after setting the target flags.
    221 include(config-ix)
    222 
    223 if (LIBCXXABI_HAS_NOSTDINCXX_FLAG)
    224   list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
    225   # Remove -stdlib flags to prevent them from causing an unused flag warning.
    226   string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
    227   string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
    228 endif()
    229 
    230 if (LIBCXXABI_USE_COMPILER_RT)
    231   list(APPEND LIBCXXABI_LINK_FLAGS "-rtlib=compiler-rt")
    232 endif()
    233 
    234 # Let the library headers know they are currently being used to build the
    235 # library.
    236 add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
    237 
    238 # Disable DLL annotations on Windows for static builds.
    239 if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
    240   add_definitions(-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
    241 endif()
    242 
    243 add_compile_flags_if_supported(-Werror=return-type)
    244 
    245 # Get warning flags
    246 add_compile_flags_if_supported(-W)
    247 add_compile_flags_if_supported(-Wall)
    248 add_compile_flags_if_supported(-Wchar-subscripts)
    249 add_compile_flags_if_supported(-Wconversion)
    250 add_compile_flags_if_supported(-Wmismatched-tags)
    251 add_compile_flags_if_supported(-Wmissing-braces)
    252 add_compile_flags_if_supported(-Wnewline-eof)
    253 add_compile_flags_if_supported(-Wunused-function)
    254 add_compile_flags_if_supported(-Wshadow)
    255 add_compile_flags_if_supported(-Wshorten-64-to-32)
    256 add_compile_flags_if_supported(-Wsign-compare)
    257 add_compile_flags_if_supported(-Wsign-conversion)
    258 add_compile_flags_if_supported(-Wstrict-aliasing=2)
    259 add_compile_flags_if_supported(-Wstrict-overflow=4)
    260 add_compile_flags_if_supported(-Wunused-parameter)
    261 add_compile_flags_if_supported(-Wunused-variable)
    262 add_compile_flags_if_supported(-Wwrite-strings)
    263 add_compile_flags_if_supported(-Wundef)
    264 
    265 if (LIBCXXABI_ENABLE_WERROR)
    266   add_compile_flags_if_supported(-Werror)
    267   add_compile_flags_if_supported(-WX)
    268 else()
    269   add_compile_flags_if_supported(-Wno-error)
    270   add_compile_flags_if_supported(-WX-)
    271 endif()
    272 if (LIBCXXABI_ENABLE_PEDANTIC)
    273   add_compile_flags_if_supported(-pedantic)
    274 endif()
    275 
    276 # Get feature flags.
    277 add_compile_flags_if_supported(-fstrict-aliasing)
    278 
    279 # Exceptions
    280 if (LIBCXXABI_ENABLE_EXCEPTIONS)
    281   # Catches C++ exceptions only and tells the compiler to assume that extern C
    282   # functions never throw a C++ exception.
    283   add_compile_flags_if_supported(-EHsc)
    284   # Do we really need to be run through the C compiler ?
    285   add_c_compile_flags_if_supported(-funwind-tables)
    286 else()
    287   add_definitions(-D_LIBCXXABI_NO_EXCEPTIONS)
    288   add_compile_flags_if_supported(-fno-exceptions)
    289   add_compile_flags_if_supported(-EHs-)
    290   add_compile_flags_if_supported(-EHa-)
    291 endif()
    292 
    293 # Assert
    294 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
    295 if (LIBCXXABI_ENABLE_ASSERTIONS)
    296   # MSVC doesn't like _DEBUG on release builds. See PR 4379.
    297   if (NOT MSVC)
    298     list(APPEND LIBCXXABI_COMPILE_FLAGS -D_DEBUG)
    299   endif()
    300   # On Release builds cmake automatically defines NDEBUG, so we
    301   # explicitly undefine it:
    302   if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
    303     list(APPEND LIBCXXABI_COMPILE_FLAGS -UNDEBUG)
    304   endif()
    305 else()
    306   if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
    307     list(APPEND LIBCXXABI_COMPILE_FLAGS -DNDEBUG)
    308   endif()
    309 endif()
    310 # Static library
    311 if (NOT LIBCXXABI_ENABLE_SHARED)
    312   list(APPEND LIBCXXABI_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
    313 endif()
    314 
    315 # Threading
    316 if (NOT LIBCXXABI_ENABLE_THREADS)
    317   if (LIBCXXABI_HAS_PTHREAD_API)
    318     message(FATAL_ERROR "LIBCXXABI_HAS_PTHREAD_API can only"
    319                         " be set to ON when LIBCXXABI_ENABLE_THREADS"
    320                         " is also set to ON.")
    321   endif()
    322   if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
    323     message(FATAL_ERROR "LIBCXXABI_HAS_EXTERNAL_THREAD_API can only"
    324                         " be set to ON when LIBCXXABI_ENABLE_THREADS"
    325                         " is also set to ON.")
    326   endif()
    327   if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
    328     message(FATAL_ERROR "LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY can only"
    329                         " be set to ON when LIBCXXABI_ENABLE_THREADS"
    330                         " is also set to ON.")
    331   endif()
    332   add_definitions(-D_LIBCXXABI_HAS_NO_THREADS)
    333 endif()
    334 
    335 if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
    336   if (LIBCXXABI_HAS_PTHREAD_API)
    337     message(FATAL_ERROR "The options LIBCXXABI_HAS_EXTERNAL_THREAD_API"
    338                         " and LIBCXXABI_HAS_PTHREAD_API cannot be both"
    339                         " set to ON at the same time.")
    340   endif()
    341   if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
    342     message(FATAL_ERROR "The options LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY"
    343                         " and LIBCXXABI_HAS_EXTERNAL_THREAD_API cannot be both"
    344                         " set to ON at the same time.")
    345   endif()
    346 endif()
    347 
    348 set(LIBCXXABI_HAS_UNDEFINED_SYMBOLS OFF)
    349 if ((NOT LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
    350     OR (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXXABI_ENABLE_SHARED)
    351     OR MINGW)
    352   set(LIBCXXABI_HAS_UNDEFINED_SYMBOLS ON)
    353 endif()
    354 
    355 if (LIBCXXABI_HAS_UNDEFINED_SYMBOLS)
    356   # Need to allow unresolved symbols if this is to work with shared library builds
    357   if (APPLE)
    358     list(APPEND LIBCXXABI_LINK_FLAGS "-undefined dynamic_lookup")
    359   else()
    360     # Relax this restriction from HandleLLVMOptions
    361     string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
    362   endif()
    363 endif()
    364 
    365 if (LIBCXXABI_HAS_PTHREAD_API)
    366   add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
    367 endif()
    368 
    369 if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
    370   add_definitions(-D_LIBCPP_HAS_THREAD_API_EXTERNAL)
    371 endif()
    372 
    373 if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
    374   add_definitions(-D_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
    375 endif()
    376 
    377 # Prevent libc++abi from having library dependencies on libc++
    378 add_definitions(-D_LIBCPP_DISABLE_EXTERN_TEMPLATE)
    379 
    380 if (MSVC)
    381   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    382 endif()
    383 
    384 # Define LIBCXXABI_USE_LLVM_UNWINDER for conditional compilation.
    385 if (LIBCXXABI_USE_LLVM_UNWINDER)
    386   add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER)
    387 endif()
    388 
    389 if (LIBCXXABI_SILENT_TERMINATE)
    390   add_definitions(-DLIBCXXABI_SILENT_TERMINATE)
    391 endif()
    392 
    393 if (LIBCXXABI_BAREMETAL)
    394     add_definitions(-DLIBCXXABI_BAREMETAL)
    395 endif()
    396 
    397 string(REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
    398 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS}")
    399 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
    400 
    401 #===============================================================================
    402 # Setup Source Code
    403 #===============================================================================
    404 
    405 set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
    406     "Specify path to libunwind includes." FORCE)
    407 set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
    408     "Specify path to libunwind source." FORCE)
    409 
    410 include_directories(include)
    411 if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
    412   find_path(
    413     LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL
    414     libunwind.h
    415     PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
    416           ${LIBCXXABI_LIBUNWIND_PATH}/include
    417           ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
    418           ${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
    419           ${LLVM_MAIN_SRC_DIR}/runtimes/libunwind/include
    420     NO_DEFAULT_PATH
    421   )
    422 
    423   if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
    424     set(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL "")
    425   endif()
    426 
    427   if (NOT LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "")
    428     include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
    429   endif()
    430 endif()
    431 
    432 # Add source code. This also contains all of the logic for deciding linker flags
    433 # soname, etc...
    434 add_subdirectory(src)
    435 
    436 if (NOT LIBCXXABI_INCLUDE_TESTS OR (LIBCXXABI_STANDALONE_BUILD AND NOT LIBCXXABI_ENABLE_SHARED))
    437   # We can't reasonably test the system C++ library with a static libc++abi.
    438   # We either need to be able to replace libc++abi at run time (with a shared
    439   # libc++abi), or we need to be able to replace the C++ runtime (with a non-
    440   # standalone build).
    441   message(WARNING "The libc++abi tests aren't valid when libc++abi is built "
    442                   "standalone (i.e. outside of llvm/projects/libcxxabi ) and "
    443                   "is built without a shared library.  Either build a shared "
    444                   "library, build libc++abi at the same time as you build "
    445                   "libc++, or do without testing.  No check target will be "
    446                   "available!")
    447 else()
    448   add_subdirectory(test)
    449   add_subdirectory(fuzz)
    450 endif()
    451