File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.9)
2+
3+ project (modules_test)
4+
5+ function (target_enable_modules TARGET )
6+ if (CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE )
7+ set (_MODULES_PATH $ENV{IFCPATH} /Debug)
8+ else ()
9+ set (_MODULES_PATH $ENV{IFCPATH} /Release)
10+ endif ()
11+ find_library (_MODULES_LIB NAME std PATHS ${_MODULES_PATH} NO_DEFAULT_PATH)
12+
13+ add_library (Modules::std UNKNOWN IMPORTED )
14+ if (EXISTS "${_MODULES_LIB} " )
15+ set_target_properties (Modules::std PROPERTIES
16+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
17+ IMPORTED_LOCATION "${_MODULES_LIB} " )
18+ endif ()
19+
20+ target_compile_options (${TARGET} PRIVATE /experimental:module "/module:search ${_MODULES_PATH} " )
21+ endfunction ()
22+
23+
24+ set (MODULES actor.ixx manager.ixx)
25+ set (SOURCES main.cpp manager.cpp)
26+ list (APPEND SOURCES ${MODULES} )
27+
28+ add_executable (${PROJECT_NAME} ${SOURCES} )
29+ set_source_files_properties (${MODULES} PROPERTIES LANGUAGE CXX)
30+ target_enable_modules(${PROJECT_NAME} )
31+
32+ target_link_libraries (${PROJECT_NAME} Modules::std)
33+ target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_17)
You can’t perform that action at this time.
0 commit comments