cmake_minimum_required(VERSION 3.29) # TODO before requiring CMake 4.1 or later # and/or enforcing CMP0195, please check/update # the implementation of `emit_swift_interface` # in `EmitSwiftInterface.cmake` # to ensure it keeps laying down nested swiftmodule folders if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER) cmake_policy(SET CMP0157 OLD) endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules" "${CMAKE_SOURCE_DIR}/../../cmake/modules") include(LanguageVersions) include(SwiftProjectVersion) project(SwiftStringProcessing LANGUAGES Swift C VERSION ${SWIFT_RUNTIME_VERSION}) if(NOT PROJECT_IS_TOP_LEVEL) message(FATAL_ERROR "Swift StringProcessing must build as a standalone project") endif() set(CMAKE_C_VISIBILITY_PRESET "hidden") set(CMAKE_VISIBILITY_INLINES_HIDDEN YES) set(CMAKE_POSITION_INDEPENDENT_CODE YES) set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../../" CACHE FILEPATH "Path to the root source directory of the Swift compiler") find_package(SwiftCore REQUIRED) include(GNUInstallDirs) include(AvailabilityMacros) include(EmitSwiftInterface) include(InstallSwiftInterface) include(PlatformInfo) include(ResourceEmbedding) include(CatalystSupport) option(${PROJECT_NAME}_INSTALL_NESTED_SUBDIR "Install libraries under a platform and architecture subdirectory" ON) set(${PROJECT_NAME}_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>$<$:/${${PROJECT_NAME}_PLATFORM_SUBDIR}/${${PROJECT_NAME}_ARCH_SUBDIR}>") set(${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$>:_static>$<$:/${${PROJECT_NAME}_PLATFORM_SUBDIR}>") option(${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION "Generate ABI resilient runtime libraries" ${SwiftCore_ENABLE_LIBRARY_EVOLUTION}) option(${PROJECT_NAME}_ENABLE_PRESPECIALIZATION "Enable generic metadata prespecialization" ${SwiftCore_ENABLE_PRESPECIALIZATION}) add_compile_options( $<$:-explicit-module-build> $<$:-nostdlibimport> "$<$:SHELL:-enable-experimental-feature NoncopyableGenerics2>" "$<$:SHELL:-enable-experimental-feature SuppressedAssociatedTypes>" "$<$:SHELL:-enable-experimental-feature SE427NoInferenceOnExtension>" "$<$:SHELL:-enable-experimental-feature NonescapableTypes>" "$<$:SHELL:-enable-experimental-feature LifetimeDependence>" "$<$:SHELL:-enable-experimental-feature InoutLifetimeDependence>" "$<$:SHELL:-enable-experimental-feature LifetimeDependenceMutableAccessors>" "$<$:SHELL:-enable-upcoming-feature MemberImportVisibility>" "$<$:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" "$<$:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" "$<$:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>" "$<$:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>" "$<$:SHELL:-Werror StrictMemorySafety>" "$<$:-warn-implicit-overrides>" "$<$,$>:-enable-library-evolution>" "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") find_package(SwiftSwiftDirectRuntime) # LNK4049: symbol 'symbol' defined in 'filename.obj' is imported # LNK4286: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' # LNK4217: symbol 'symbol' defined in 'filename_1.obj' is imported by 'filename_2.obj' in function 'function' # # We cannot selectively filter the linker warnings as we do not use the MSVC # frontned and `clang-cl` (and `clang`) currently do not support `/WX:nnnn`. As # a compromise, treat all linker warnings as errors. add_link_options($<$:LINKER:/WX>) # Ensure all symbols are fully resolved on Linux add_link_options($<$:LINKER:-z,defs>) add_subdirectory(_RegexParser) add_subdirectory(_StringProcessing) add_subdirectory(RegexBuilder)