Skip to content

Support the package access modifier in CMake build#3239

Open
ahoppen wants to merge 1 commit intoswiftlang:mainfrom
ahoppen:package-access-modifier
Open

Support the package access modifier in CMake build#3239
ahoppen wants to merge 1 commit intoswiftlang:mainfrom
ahoppen:package-access-modifier

Conversation

@ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 18, 2026

As far as I can tell, we weren’t passing -package-name if the host compiler does not support CMO at all. Since we require Swift 5.9 (indicated by the Package manifest), we can unconditionally set -package-name.

@ahoppen
Copy link
Member Author

ahoppen commented Jan 18, 2026

@swift-ci Please test

As far as I can tell, we weren’t passing `-package-name` if the host compiler does not support CMO at all. Since we require Swift 5.9 (indicated by the Package manifest), we can unconditionally set `-package-name`.
@ahoppen ahoppen force-pushed the package-access-modifier branch from 50e1d30 to 139981f Compare January 19, 2026 08:11
@ahoppen
Copy link
Member Author

ahoppen commented Jan 19, 2026

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jan 19, 2026

@swift-ci Please test Windows

set(SWIFTSYNTAX_PACKAGE_NAME "${SWIFT_MODULE_ABI_NAME_PREFIX}${PROJECT_NAME}")
endif()

add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-package-name ${SWIFTSYNTAX_PACKAGE_NAME}>")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is debatable whether to put this in global CMakeLists.txt, or to specify target_compile_options in add_swift_syntax_library(). But my personal preference is the latter.
(I admit it was me who added -disable-implicit-string-processing-module-import there, but I think I should move it too)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like putting it up here because this way it would also apply to any executable target we might add (no plans for it, just design-wise). But you’re CMake knowledge is superior to mine so I’ll defer to your opinion if you still think this should be in add_swift_syntax_library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants