File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,24 @@ function(target_enable_modules TARGET)
20
20
target_compile_options (${TARGET} PRIVATE /experimental:module "/module:search ${_MODULES_PATH} " )
21
21
endfunction ()
22
22
23
+ function (target_add_module TARGET MODULE_FILES)
24
+ set (_module_files ${MODULE_FILES} ${ARGN} )
25
+ get_target_property (_srcs ${TARGET} SOURCES )
26
+
27
+ foreach (_module_file ${_module_files} )
28
+ message (${_module_file} )
29
+ set_source_files_properties (${_module_file} PROPERTIES LANGUAGE CXX)
30
+ list (INSERT _srcs 0 ${_module_file} )
31
+ endforeach ()
32
+
33
+ set_target_properties (${TARGET} PROPERTIES SOURCES "${_srcs} " )
34
+ endfunction ()
23
35
24
- set (MODULES actor.ixx manager.ixx)
25
36
set (SOURCES main.cpp manager.cpp)
26
- list (APPEND SOURCES ${MODULES} )
27
37
28
38
add_executable (${PROJECT_NAME} ${SOURCES} )
29
- set_source_files_properties (${MODULES} PROPERTIES LANGUAGE CXX)
30
39
target_enable_modules(${PROJECT_NAME} )
40
+ target_add_module(${PROJECT_NAME} actor.ixx manager.ixx)
31
41
32
42
target_link_libraries (${PROJECT_NAME} Modules::std)
33
43
target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_17)
You can’t perform that action at this time.
0 commit comments