[英]How to compile CMake generated mocs_compilation_Debug.cpp with /bigobj
my problem is, that I don't know how to tell my CMakeLists.txt
to compile the generated mocs_compilation_Debug.cpp
with /bigobj
.我的问题是,我不知道如何告诉我的
CMakeLists.txt
用/bigobj
mocs_compilation_Debug.cpp
I know that I can edit /bigobj in Visual Studio but I need that file to be generated with the compile option.我知道我可以在 Visual Studio 中编辑 /bigobj,但我需要使用 compile 选项生成该文件。
I actually have usecases where I add sources in CMakeLists.txt with that compile option but all of the files already exist when I add the compile option.我实际上有一些用例,我在 CMakeLists.txt 中使用该编译选项添加源,但是当我添加编译选项时所有文件都已经存在。 The mocs_compilation_Debug.cpp does not exists at generation time (at least at first generation).
mocs_compilation_Debug.cpp 在生成时不存在(至少在第一代)。
I tried the following in the according CMakeLists.txt:我在相应的 CMakeLists.txt 中尝试了以下内容:
set(BIG_OBJ_SOURCES
"${CMAKE_CURRENT_BINARY_DIR}/UnitTests_autogen/mocs_compilation_Debug.cpp"
)
set_source_files_properties(${BIG_OBJ_SOURCES} PROPERTIES COMPILE_OPTIONS "/bigobj")
I did this because the according moc_compilation_Debug.cpp is being generated in the binary tree but its not of use.我这样做是因为在二叉树中生成了相应的 moc_compilation_Debug.cpp 但它没有用。
Has anyone came across this same problem or has an idea?有没有人遇到过同样的问题或有想法?
Thanks.谢谢。
I mentioned that我提到过
set(BIG_OBJ_SOURCES
"${CMAKE_CURRENT_BINARY_DIR}/UnitTests_autogen/mocs_compilation_Debug.cpp"
)
set_source_files_properties(${BIG_OBJ_SOURCES} PROPERTIES COMPILE_OPTIONS "/bigobj")
did not work.不工作。 But it works.
但它有效。 I deleted all CMake generated Files and generated them again.
我删除了所有 CMake 生成的文件并再次生成它们。 I checked the file properties in the IDE and saw
/bigobj
as compile option.我检查了 IDE 中的文件属性并将
/bigobj
作为编译选项。 So it is possible to add a Compile Option to a file which is not existent at generation time.因此,可以将编译选项添加到生成时不存在的文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.