@@ -124,6 +124,12 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
124124 the shared library they shipped should turn this on and see `include/__availability`
125125 for more details." OFF )
126126option (LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" OFF )
127+ # TODO MODULES Remove this option and test for the requirements (CMake/Clang) instead.
128+ option (LIBCXX_ENABLE_STD_MODULES
129+ "Whether to enable the building the C++23 `std` module. This feature is
130+ experimental and has additional dependencies. Only enable this when
131+ interested in testing or developing this module. See
132+ https://libcxx.llvm.org/Modules.html for more information." OFF )
127133
128134if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
129135 set (LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in" )
@@ -773,6 +779,7 @@ config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE)
773779config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION)
774780config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
775781config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
782+ config_define_if_not(LIBCXX_ENABLE_STD_MODULES _LIBCPP_HAS_NO_STD_MODULES)
776783config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
777784config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
778785
@@ -856,15 +863,19 @@ endfunction()
856863add_subdirectory (include )
857864add_subdirectory (src)
858865add_subdirectory (utils)
859- add_subdirectory (modules)
866+ if (LIBCXX_ENABLE_STD_MODULES)
867+ add_subdirectory (modules)
868+ endif ()
860869
861870set (LIBCXX_TEST_DEPS "cxx_experimental" )
862871
863872if (LIBCXX_ENABLE_CLANG_TIDY)
864873 list (APPEND LIBCXX_TEST_DEPS cxx-tidy)
865874endif ()
866875
867- list (APPEND LIBCXX_TEST_DEPS generate-cxx-modules)
876+ if (LIBCXX_ENABLE_STD_MODULES)
877+ list (APPEND LIBCXX_TEST_DEPS generate-cxx-modules generate-test -module-std)
878+ endif ()
868879
869880if (LIBCXX_INCLUDE_BENCHMARKS)
870881 add_subdirectory (benchmarks)
0 commit comments