简体   繁体   English

如何使用 /bigobj 编译 CMake 生成的 mocs_compilation_Debug.cpp

[英]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.

相关问题 如何在visual studio中设置compile flag / bigobj? - How to set compile flag /bigobj in visual studio? 如何使用CMake分别编译*.cpp和*.cu? - How to use CMake to compile *.cpp and *.cu seperately? cmake:读取和编译动态生成的cpp文件列表 - cmake: read and compile dynamically-generated list of cpp files CMake / Ninja试图编译已删除的`.cpp`文件 - CMake/Ninja attempting to compile deleted `.cpp` file 如何在vim中使用cmake / gcc进行编译/跳转调试 - how to compile/jump-debug using cmake/gcc within vim 安卓工作室,CMake。 如何在编译时打印调试消息? - Android Studio, CMake. How to print debug message in compile time? 如何在Linux中编译后以这样的方式编译c / cpp代码以提供经过预处理的汇编文件和目标文件? - how to compile c/cpp code in such a way that it gives preprocessed assembled and object file after compilation in linux? CMake:错误的编译顺序:子模块中的generate_protobuf_cpp - CMake: incorrect compilation order: generate_protobuf_cpp in submodule 使用 Visual Studio 2019 和 cmake 调试 Yaml_cpp - Yaml_cpp in debug with visual studio 2019 and cmake 如何设置发布/调试模式以使用 Microsoft C++ 工具集在命令提示符下编译 cpp 文件 - How to set release/debug mode to compile a cpp file at a command prompt using Microsoft C++ toolset
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM