Skip to content

Commit ae8e26c

Browse files
Copilotavikivity
andcommitted
Define SEASTAR_MODULE only for module interface file
The SEASTAR_MODULE macro should only be defined when compiling the module interface file (seastar.cppm), not for the implementation .cc files. When .cc files are compiled with SEASTAR_MODULE defined, headers expand SEASTAR_MODULE_EXPORT_BEGIN to "export {", which is invalid outside a module purview, causing compilation errors like: "export declaration can only be used within a module purview" Now SEASTAR_MODULE is set only for seastar.cppm using set_source_files_properties, while implementation files compile without it, making export macros expand to nothing in regular translation units. Co-authored-by: avikivity <[email protected]>
1 parent ff6a32f commit ae8e26c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ target_compile_definitions (seastar-module
9898
SEASTAR_API_LEVEL=${Seastar_API_LEVEL}
9999
SEASTAR_SCHEDULING_GROUPS_COUNT=${Seastar_SCHEDULING_GROUPS_COUNT}
100100
PRIVATE
101-
SEASTAR_MODULE
102101
${Seastar_PRIVATE_COMPILE_DEFINITIONS})
102+
# Define SEASTAR_MODULE only for the module interface file, not implementation files
103+
set_source_files_properties (seastar.cppm
104+
PROPERTIES
105+
COMPILE_DEFINITIONS "SEASTAR_MODULE")
103106
target_compile_options (seastar-module
104107
PUBLIC
105108
-U_FORTIFY_SOURCE)

0 commit comments

Comments
 (0)