Skip to content

Commit e589496

Browse files
authored
[libc++] Define all CMake configuration features in the same location (#115361)
This moves the configuration of the CMake features to turn off RTTI, exceptions and friends to the beginning of the CMake file, where we configure other optional parts of the library. This fixes an important bug where we would disable the benchmarks because these options were not defined yet, leading to the build thinking they were defined to OFF.
1 parent 576865a commit e589496

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

libcxx/CMakeLists.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ include(HandleCompilerRT)
4747
# Basic options ---------------------------------------------------------------
4848
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
4949
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
50+
option(LIBCXX_ENABLE_EXCEPTIONS "Enable exceptions in the built library." ON)
51+
option(LIBCXX_ENABLE_RTTI
52+
"Use runtime type information.
53+
This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
5054
option(LIBCXX_ENABLE_FILESYSTEM
5155
"Whether to include support for parts of the library that rely on a filesystem being
5256
available on the platform. This includes things like most parts of <filesystem> and
@@ -97,6 +101,10 @@ option(LIBCXX_ENABLE_WIDE_CHARACTERS
97101
support the C functionality for wide characters. When wide characters are
98102
not supported, several parts of the library will be disabled, notably the
99103
wide character specializations of std::basic_string." ON)
104+
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
105+
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
106+
"Build libc++ with support for a monotonic clock.
107+
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
100108

101109
# To use time zone support in libc++ the platform needs to have the IANA
102110
# database installed. Libc++ will fail to build if this is enabled on a
@@ -284,14 +292,6 @@ if (LIBCXX_BUILD_32_BITS)
284292
endif()
285293

286294
# Feature options -------------------------------------------------------------
287-
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
288-
option(LIBCXX_ENABLE_RTTI
289-
"Use runtime type information.
290-
This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
291-
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
292-
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
293-
"Build libc++ with support for a monotonic clock.
294-
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
295295
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
296296
option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
297297
option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF)

libcxx/utils/libcxx/test/format.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def execute(self, test, litConfig):
345345
),
346346
)
347347
steps = [
348-
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} %{benchmark_flags} -o %t.exe",
348+
"%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{benchmark_flags} %{link_flags} -o %t.exe",
349349
]
350350
if "enable-benchmarks=run" in test.config.available_features:
351351
steps += ["%dbg(EXECUTED AS) %{exec} %t.exe"]

0 commit comments

Comments
 (0)