I'm working on a project that uses C++ modules, but instead of using the MS standard *.ixx file extension for module interfaces (as Visual Studio expects), I’m using *.cppm for my module interface files and *.cpp for implementation files. Because of this, I need to explicitly set the /interface
and /internalPartition
flags for the files in the Visual Studio project settings:
I have a CMake script for the project though, so I'd prefer it if the flags could just be set through CMake instead of the user having to do it manually.
Is it possible to do this somehow? I know about the set_source_files_properties
function, but my attempts to set the interface flag did not have any effect:
set_source_files_properties(src/util_zip.cppm PROPERTIES COMPILE_OPTIONS "/interface")
set_source_files_properties(src/util_zip.cppm PROPERTIES COMPILE_FLAGS "/interface")
Any insights or examples would be greatly appreciated!
I'm working on a project that uses C++ modules, but instead of using the MS standard *.ixx file extension for module interfaces (as Visual Studio expects), I’m using *.cppm for my module interface files and *.cpp for implementation files. Because of this, I need to explicitly set the /interface
and /internalPartition
flags for the files in the Visual Studio project settings:
I have a CMake script for the project though, so I'd prefer it if the flags could just be set through CMake instead of the user having to do it manually.
Is it possible to do this somehow? I know about the set_source_files_properties
function, but my attempts to set the interface flag did not have any effect:
set_source_files_properties(src/util_zip.cppm PROPERTIES COMPILE_OPTIONS "/interface")
set_source_files_properties(src/util_zip.cppm PROPERTIES COMPILE_FLAGS "/interface")
Any insights or examples would be greatly appreciated!
Share Improve this question edited Mar 31 at 9:51 prapin 6,8985 gold badges29 silver badges54 bronze badges asked Mar 17 at 8:38 SilverlanSilverlan 2,8115 gold badges36 silver badges69 bronze badges 3 |1 Answer
Reset to default 0Just putting this as an answer if there are similar future issues. From the documentation, it looks like you also needs to use /TP
in conjunction with /interface flag so it should be something like
set_source_files_properties(src/util_zip.cppm PROPERTIES COMPILE_FLAGS "/interface /TP")
/TP
in conjunction with/interface
flag so it should be something likeset_source_files_properties(src/util_zip.cppm PROPERTIES COMPILE_FLAGS "/interface /TP")
– vht981230 Commented Mar 21 at 4:35