swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.72k stars 1.34k forks source link

Setting of Swift_MODULE_DIRECTORY (and probably other global directories) inappropriate. #7654

Open dabrahams opened 3 months ago

dabrahams commented 3 months ago

https://github.com/apple/swift-package-manager/blob/d98b7539cb141364577e6a4e27dbeb7fc5ccf75f/CMakeLists.txt#L23-L28

See this warning, which says that it's incompatible with multi-config generators. It also overrides a decision that should be the prerogative of the top level CMake project and if nothing else should be conditionalized on PROJECT_IS_TOP_LEVEL. But really it shouldn't be set at all. All of these settings artificially group files in a way that can cause builds to succeed even if dependencies have not been properly specified, or fail if properly specified, and if nothing else are likely to break all multi-config generators (which includes Xcode) for the forseeable future.