include(CheckSymbolExists) check_symbol_exists(_LIBCPP_VERSION "version" HAVE_LIBCPP_VERSION) check_symbol_exists(__GLIBCXX__ "version" HAVE___GLIBCXX__) if(NOT APPLE) add_subdirectory(cxxshim) endif() if(HAVE___GLIBCXX__) add_subdirectory(libstdcxx) endif() add_subdirectory(std) add_library(swiftCxx STATIC CxxConvertibleToBool.swift CxxConvertibleToCollection.swift CxxDictionary.swift CxxOptional.swift CxxPair.swift CxxRandomAccessCollection.swift CxxSequence.swift CxxSet.swift CxxSpan.swift CxxVector.swift UnsafeCxxIterators.swift) set_target_properties(swiftCxx PROPERTIES Swift_MODULE_NAME Cxx) target_compile_options(swiftCxx PRIVATE "$<$:-cxx-interoperability-mode=default>" "$<$:-warn-implicit-overrides>" # This module should not pull in the C++ standard library, so we disable it # explicitly. For functionality that depends on the C++ stdlib, use C++ # stdlib overlay (`swiftstd` module). "$<$:SHELL:-swift-version 5>" "$<$:SHELL:-Xcc -nostdinc++>" "$<$:SHELL:-enable-experimental-feature AllowUnsafeAttribute>" "$<$:SHELL:-enable-experimental-feature BuiltinModule>" "$<$:SHELL:-enable-experimental-feature Lifetimes>") target_link_libraries(swiftCxx PRIVATE swiftCore) install(TARGETS swiftCxx EXPORT SwiftOverlayTargets ARCHIVE DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}" LIBRARY DESTINATION "${SwiftOverlay_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") emit_swift_interface(swiftCxx) install_swift_interface(swiftCxx) embed_manifest(swiftCxx)