blob: 7017ce4079acc8a746fe5d174decb69007ad08cb [file] [log] [blame]
Michael J. Spencer626916f2010-12-10 19:47:541# See www/CMake.html for instructions on how to build libcxx with CMake.
2
3#===============================================================================
4# Setup Project
5#===============================================================================
Michael J. Spencer626916f2010-12-10 19:47:546cmake_minimum_required(VERSION 2.8)
7
Eric Fiseliere9d4b232015-01-26 21:56:458if(POLICY CMP0042)
9 cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
10endif()
Eric Fiseliereb6e2ea2015-07-30 22:30:3411if(POLICY CMP0022)
12 cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang
13endif()
14
15project(libcxx CXX C)
Eric Fiseliere9d4b232015-01-26 21:56:4516
Michael J. Spencer626916f2010-12-10 19:47:5417set(PACKAGE_NAME libcxx)
18set(PACKAGE_VERSION trunk-svn)
19set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
Tanya Lattnerd08dbfc2015-08-05 03:59:1420set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
Michael J. Spencer626916f2010-12-10 19:47:5421
22# Add path for custom modules
23set(CMAKE_MODULE_PATH
Michael J. Spencer626916f2010-12-10 19:47:5424 "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
25 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
Alexey Samsonov179fa782013-09-30 09:10:0126 ${CMAKE_MODULE_PATH}
Michael J. Spencer626916f2010-12-10 19:47:5427 )
28
29# Require out of source build.
30include(MacroEnsureOutOfSourceBuild)
31MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
32 "${PROJECT_NAME} requires an out of source build. Please create a separate
33 build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
34 )
35
Eric Fiseliereb6e2ea2015-07-30 22:30:3436# Find the LLVM sources and simulate LLVM CMake options.
37include(HandleOutOfTreeLLVM)
38if (LIBCXX_BUILT_STANDALONE AND NOT LLVM_FOUND)
39 message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
40 "llvm-config not found and LLVM_PATH not defined.\n"
41 "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
42 "or -DLLVM_PATH=path/to/llvm-source-root.")
Eric Fiselier5514d362015-07-29 23:46:5543endif()
Peter Collingbourne4c81b002013-10-03 21:58:2544
Eric Fiseliereb6e2ea2015-07-30 22:30:3445
Michael J. Spencer626916f2010-12-10 19:47:5446#===============================================================================
47# Setup CMake Options
48#===============================================================================
49
Eric Fiseliereb6e2ea2015-07-30 22:30:3450# Basic options ---------------------------------------------------------------
51option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
52option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
53
54option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
Eric Fiselierb9f425a2015-08-22 19:40:4955option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS})
Eric Fiseliereb6e2ea2015-07-30 22:30:3456set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
57 "Define suffix of library directory name (32/64)")
58option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
Eric Fiselier961269d2015-08-26 20:18:2159option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
Eric Fiseliereb6e2ea2015-07-30 22:30:3460option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
Evgeniy Stepanov4f01aa82015-10-13 23:48:2861set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
62option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
Eric Fiseliereb6e2ea2015-07-30 22:30:3463
64# ABI Library options ---------------------------------------------------------
65set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
66 "Specify C++ ABI library to use." FORCE)
67set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
68set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
69
70option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
71
Eric Fiselier8cbf0202015-10-14 19:54:0372# Generate and install a linker script inplace of libc++.so. The linker script
73# will link libc++ to the correct ABI library.
74option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
75 "Use and install a linker script for the given ABI library" OFF)
76
Eric Fiseliereb6e2ea2015-07-30 22:30:3477# Build libc++abi with libunwind. We need this option to determine whether to
78# link with libunwind or libgcc_s while running the test cases.
79option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
80
81# Target options --------------------------------------------------------------
82option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
83set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
84set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
85
86# Feature options -------------------------------------------------------------
Michael J. Spencer626916f2010-12-10 19:47:5487option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
88option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
Ed Schoutenb33ae5b2015-03-12 15:44:3989option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
Ed Schoutenabd06b42015-03-26 14:35:4690option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
91option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
Eric Fiselier7330ed32014-12-06 21:02:5892option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
Ed Schouten323ade32015-06-24 08:44:3893option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
Eric Fiselier7330ed32014-12-06 21:02:5894option(LIBCXX_ENABLE_MONOTONIC_CLOCK
95 "Build libc++ with support for a monotonic clock.
Jonathan Roelofs5e91fa12015-08-24 21:20:0796 This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
Eric Fiseliereb6e2ea2015-07-30 22:30:3497
98# Misc options ----------------------------------------------------------------
Eric Fiseliercb23a492015-10-10 03:34:5299# FIXME: Turn -pedantic back ON. It is currently off because it warns
100# about #include_next which is used everywhere.
101option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
Eric Fiseliereb6e2ea2015-07-30 22:30:34102option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
103
Eric Fiselierbf9653d2015-03-31 04:15:45104option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
105set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
Eric Fiseliereb6e2ea2015-07-30 22:30:34106 "The Profile-rt library used to build with code coverage")
107
Eric Fiselier961269d2015-08-26 20:18:21108# Don't allow a user to accidentally overwrite the system libc++ installation on Darwin.
109# If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++
110# will not be generated and a warning will be issued.
111option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF)
112mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default.
113
114if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL)
115 if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
116 message(WARNING "Disabling libc++ install rules because installation would "
117 "overwrite the systems installation. Configure with "
118 "-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.")
119 mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option.
120 set(LIBCXX_INSTALL_HEADERS OFF)
121 set(LIBCXX_INSTALL_LIBRARY OFF)
122 endif()
123endif()
124
Eric Fiseliereb6e2ea2015-07-30 22:30:34125#===============================================================================
126# Check option configurations
127#===============================================================================
128
129# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when
130# LIBCXX_ENABLE_THREADS is on.
131if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
132 message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF"
133 " when LIBCXX_ENABLE_THREADS is also set to OFF.")
Eric Fiselier25a15162014-08-18 05:03:46134endif()
Michael J. Spencer626916f2010-12-10 19:47:54135
Eric Fiseliereb6e2ea2015-07-30 22:30:34136# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
137# is ON.
138if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
139 message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
140endif()
141
142# Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
143# and check that we can build with 32 bits if requested.
144if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
145 if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
146 message(STATUS "Building 32 bits executables and libraries.")
147 endif()
148elseif(LIBCXX_BUILD_32_BITS)
149 message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
150endif()
151
152# Check that this option is not enabled on Apple and emit a usage warning.
Eric Fiselierc0b166e2015-03-03 15:59:51153if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
154 if (APPLE)
155 message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
156 else()
157 message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
158 endif()
159endif()
160
Eric Fiselier8cbf0202015-10-14 19:54:03161if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
162 if (APPLE)
163 message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets")
164 endif()
165 if (NOT PYTHONINTERP_FOUND)
166 message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.")
167 endif()
168endif()
169
170if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
171 message(FATAL_ERROR "Conflicting options given.
172 LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
173 LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
174endif()
175
Michael J. Spencer626916f2010-12-10 19:47:54176#===============================================================================
177# Configure System
178#===============================================================================
179
Eric Fiselier4778eed2014-12-20 03:16:55180set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
181set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
182set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
Chandler Carruth7a033ca2014-12-29 12:15:47183set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
Eric Fiselier4778eed2014-12-20 03:16:55184
Eric Fiseliereb6e2ea2015-07-30 22:30:34185set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
186set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
187
Eric Fiselier8e2855c2014-11-15 06:26:30188# Declare libc++ configuration variables.
189# They are intended for use as follows:
190# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
191# LIBCXX_COMPILE_FLAGS: Compile only flags.
192# LIBCXX_LINK_FLAGS: Linker only flags.
Eric Fiselier8e2855c2014-11-15 06:26:30193set(LIBCXX_COMPILE_FLAGS "")
194set(LIBCXX_LINK_FLAGS "")
Eric Fiseliereb6e2ea2015-07-30 22:30:34195set(LIBCXX_LIBRARIES "")
Eric Fiselier8e2855c2014-11-15 06:26:30196
Eric Fiselier9a1468f2014-11-15 17:25:23197# Configure compiler.
198include(config-ix)
Eric Fiseliereb6e2ea2015-07-30 22:30:34199
Eric Fiselierbf9653d2015-03-31 04:15:45200# Configure coverage options.
201if (LIBCXX_GENERATE_COVERAGE)
202 include(CodeCoverage)
203 set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
204endif()
Eric Fiselier9a1468f2014-11-15 17:25:23205
Eric Fiseliereb6e2ea2015-07-30 22:30:34206string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
207
Eric Fiselier9a1468f2014-11-15 17:25:23208#===============================================================================
209# Setup Compiler Flags
210#===============================================================================
211
Eric Fiseliereb6e2ea2015-07-30 22:30:34212include(HandleLibCXXABI) # Steup the ABI library flags
213
214# Include macros for adding and removing libc++ flags.
215include(HandleLibcxxFlags)
216
217# Remove flags that may have snuck in.
218remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
219 -stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
220
Eric Fiselier499d8782015-10-13 23:56:33221# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC.
Eric Fiselier7b081f62015-10-15 20:27:15222# Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors
223# so they don't get transformed into -Wno and -errors respectivly.
224remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
Eric Fiselier499d8782015-10-13 23:56:33225
Eric Fiseliereb6e2ea2015-07-30 22:30:34226# Required flags ==============================================================
227add_compile_flags_if_supported(-std=c++11)
228if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
229 message(FATAL_ERROR "C++11 is required but the compiler does not support -std=c++11")
230endif()
231
Eric Fiselier5514d362015-07-29 23:46:55232# On all systems the system c++ standard library headers need to be excluded.
Eric Fiseliereb6e2ea2015-07-30 22:30:34233# MSVC only has -X, which disables all default includes; including the crt.
234# Thus, we do nothing and hope we don't accidentally include any of the C++
235# headers
236add_compile_flags_if_supported(-nostdinc++)
Eric Fiselierd74dee92015-07-29 21:07:28237
Eric Fiseliereb6e2ea2015-07-30 22:30:34238# Target flags ================================================================
239add_flags_if(LIBCXX_BUILD_32_BITS -m32)
240add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
241add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
242add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
Eric Fiselier91eeba82015-07-29 00:03:51243
Eric Fiseliereb6e2ea2015-07-30 22:30:34244# Warning flags ===============================================================
Eric Fiselier692177d2015-07-18 20:40:46245add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Eric Fiseliereb6e2ea2015-07-30 22:30:34246add_compile_flags_if_supported(
247 -Wall -W -Wwrite-strings
248 -Wno-unused-parameter -Wno-long-long
249 -Werror=return-type)
Michael J. Spencer626916f2010-12-10 19:47:54250if (LIBCXX_ENABLE_WERROR)
Eric Fiseliereb6e2ea2015-07-30 22:30:34251 add_compile_flags_if_supported(-Werror)
252 add_compile_flags_if_supported(-WX)
Eric Fiselier26d23902015-07-31 01:25:01253else()
254 # TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is
255 # added elsewhere.
256 add_compile_flags_if_supported(-Wno-error)
Michael J. Spencer626916f2010-12-10 19:47:54257endif()
258if (LIBCXX_ENABLE_PEDANTIC)
Eric Fiseliereb6e2ea2015-07-30 22:30:34259 add_compile_flags_if_supported(-pedantic)
Michael J. Spencer626916f2010-12-10 19:47:54260endif()
261
Eric Fiseliereb6e2ea2015-07-30 22:30:34262# Exception flags =============================================================
Michael J. Spencer626916f2010-12-10 19:47:54263if (LIBCXX_ENABLE_EXCEPTIONS)
264 # Catches C++ exceptions only and tells the compiler to assume that extern C
265 # functions never throw a C++ exception.
Eric Fiseliereb6e2ea2015-07-30 22:30:34266 add_compile_flags_if_supported(-EHsc)
Michael J. Spencer626916f2010-12-10 19:47:54267else()
Eric Fiseliereb6e2ea2015-07-30 22:30:34268 add_definitions(-D_LIBCPP_NO_EXCEPTIONS)
269 add_compile_flags_if_supported(-EHs- -EHa-)
270 add_compile_flags_if_supported(-fno-exceptions)
Michael J. Spencer626916f2010-12-10 19:47:54271endif()
Eric Fiseliereb6e2ea2015-07-30 22:30:34272
273# RTTI flags ==================================================================
Michael J. Spencer626916f2010-12-10 19:47:54274if (NOT LIBCXX_ENABLE_RTTI)
Eric Fiseliereb6e2ea2015-07-30 22:30:34275 add_definitions(-D_LIBCPP_NO_RTTI)
276 add_compile_flags_if_supported(-GR-)
277 add_compile_flags_if_supported(-fno-rtti)
Michael J. Spencer626916f2010-12-10 19:47:54278endif()
Eric Fiseliereb6e2ea2015-07-30 22:30:34279
280# Assertion flags =============================================================
281define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
282define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
Howard Hinnante103a3d2012-08-05 17:37:39283if (LIBCXX_ENABLE_ASSERTIONS)
Michael J. Spencer626916f2010-12-10 19:47:54284 # MSVC doesn't like _DEBUG on release builds. See PR 4379.
Eric Fiseliereb6e2ea2015-07-30 22:30:34285 define_if_not(MSVC -D_DEBUG)
Howard Hinnant4a0e74f2013-02-25 15:50:36286endif()
Michael J. Spencer626916f2010-12-10 19:47:54287
Eric Fiseliereb6e2ea2015-07-30 22:30:34288# Feature flags ===============================================================
289define_if(MSVC -D_CRT_SECURE_NO_WARNINGS)
Eric Fiselier5514d362015-07-29 23:46:55290
Jonathan Roelofs5e91fa12015-08-24 21:20:07291# Sanitizer flags =============================================================
Eric Fiselier5514d362015-07-29 23:46:55292
293# Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
294# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
295if (LIBCXX_BUILT_STANDALONE)
Eric Fiseliereb6e2ea2015-07-30 22:30:34296 set(LLVM_USE_SANITIZER "" CACHE STRING
297 "Define the sanitizer used to build the library and tests")
Eric Fiselier5514d362015-07-29 23:46:55298 # NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
299 # But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
300 if (LLVM_USE_SANITIZER AND NOT MSVC)
Eric Fiseliereb6e2ea2015-07-30 22:30:34301 add_flags_if_supported("-fno-omit-frame-pointer")
302 add_flags_if_supported("-gline-tables-only")
303
Eric Fiselier5514d362015-07-29 23:46:55304 if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
305 NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
Eric Fiseliereb6e2ea2015-07-30 22:30:34306 add_flags_if_supported("-gline-tables-only")
Eric Fiselier5514d362015-07-29 23:46:55307 endif()
308 if (LLVM_USE_SANITIZER STREQUAL "Address")
Eric Fiseliereb6e2ea2015-07-30 22:30:34309 add_flags("-fsanitize=address")
Eric Fiselier5514d362015-07-29 23:46:55310 elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
Eric Fiseliereb6e2ea2015-07-30 22:30:34311 add_flags(-fsanitize=memory)
Eric Fiselier5514d362015-07-29 23:46:55312 if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
Eric Fiseliereb6e2ea2015-07-30 22:30:34313 add_flags("-fsanitize-memory-track-origins")
Eric Fiselier5514d362015-07-29 23:46:55314 endif()
315 elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
Eric Fiseliereb6e2ea2015-07-30 22:30:34316 add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
Eric Fiselier5514d362015-07-29 23:46:55317 elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
Eric Fiseliereb6e2ea2015-07-30 22:30:34318 add_flags(-fsanitize=thread)
Eric Fiselier5514d362015-07-29 23:46:55319 else()
320 message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
321 endif()
Eric Fiseliereb6e2ea2015-07-30 22:30:34322 elseif(LLVM_USE_SANITIZER AND MSVC)
323 message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
Eric Fiselier5514d362015-07-29 23:46:55324 endif()
325endif()
Eric Fiselier73ffc782015-10-13 22:12:02326
327# Configuration file flags =====================================================
Evgeniy Stepanov4f01aa82015-10-13 23:48:28328if (NOT LIBCXX_ABI_VERSION EQUAL "1")
329 config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
330endif()
331config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
332
Eric Fiselier73ffc782015-10-13 22:12:02333config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
334config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
335config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT)
336config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
337config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
338config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
339
340if (LIBCXX_NEEDS_SITE_CONFIG)
341 configure_file(
342 include/__config_site.in
343 ${LIBCXX_BINARY_DIR}/__config_site
344 @ONLY)
Eric Fiseliera6622792015-10-14 00:22:05345 # Provide the config definitions by included the generated __config_site
346 # file at compile time.
347 add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
Eric Fiselier73ffc782015-10-13 22:12:02348endif()
349
Michael J. Spencer626916f2010-12-10 19:47:54350#===============================================================================
Eric Fiseliereb6e2ea2015-07-30 22:30:34351# Setup Source Code And Tests
Michael J. Spencer626916f2010-12-10 19:47:54352#===============================================================================
Michael J. Spencer626916f2010-12-10 19:47:54353include_directories(include)
Howard Hinnantc4962b32013-11-15 17:18:57354add_subdirectory(include)
Michael J. Spencer626916f2010-12-10 19:47:54355add_subdirectory(lib)
Eric Fiselierb9f425a2015-08-22 19:40:49356
Eric Fiseliereb6e2ea2015-07-30 22:30:34357if (LIBCXX_INCLUDE_TESTS)
358 add_subdirectory(test)
359endif()
Eric Fiselierb9f425a2015-08-22 19:40:49360if (LIBCXX_INCLUDE_DOCS)
361 add_subdirectory(docs)
362endif()