How to compile CMake generated mocs_compilation_Debug.cpp with /bigobj

518 Views Asked by At

my problem is, that I don't know how to tell my CMakeLists.txt to compile the generated mocs_compilation_Debug.cpp with /bigobj.

I know that I can edit /bigobj in Visual Studio but I need that file to be generated with the compile option.

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. The mocs_compilation_Debug.cpp does not exists at generation time (at least at first generation).

I tried the following in the according 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.

Has anyone came across this same problem or has an idea?

Thanks.

1

There are 1 best solutions below

0
k_k On

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. I checked the file properties in the IDE and saw /bigobj as compile option. So it is possible to add a Compile Option to a file which is not existent at generation time.