0

i have a huge arm-none-eabi (gcc) cmake project.

i would like to run the entire project and abort after the preprocessor.

so example:

if i have 500 headers and 600 source files, i would like to get 1100 additional files after the preprocessor, all in a preprocessed state.

eg

// my procject

main.cpp
src/dummy.cpp
src/etc.cpp
... 

// my project after preprocessor

main.cpp
main_preprocessed.cpp
src/dummy.cpp
src/dummy_preprocessed.cpp
...

if i just add the compiler flag -E, the prepocessing happens and thells me 'linker input file unused because linking not done'. which is ok, but i dont get the preprocessed files.

just preprocessing one file is no good to me because i would need to add a lot of header files with -I, which takes a long time.

ADDITIONAL INFO:

also, what is important is that i need my project files preprocessed. additionally to my project files i do have some libraries from different manufacturers, those i build first into a static lib, then link against the lib.

user654789384
  • 305
  • 1
  • 4
  • 21
  • What happens when using the `-E` flag? Are the preprocessed files discarded? What is the desired output? Do you physically need all 1100 additional files, or just some preprocessor output for each file? – Kevin Feb 07 '20 at 12:46
  • @squareskittles would be nice to get the additional 1100 files, they could also be located in the build directory, this i dont care. but if this is no option, also each file flushed into the terminal after preprocessing would do. what happens is that i get all object files from the static library i build first, then the build abortion. so all i see is that ninja processes them in the terminal (example: [9/311] Building CXX object CMakeFiles/projectname.dir/core/src/Class1.cpp.obj – user654789384 Feb 07 '20 at 13:22
  • Did you had a look into the `.obj` files if they do contain the preprocessed output? See first comment on accepted answer of this: https://stackoverflow.com/questions/4900870/can-gcc-output-c-code-after-preprocessing – vre Feb 07 '20 at 13:56

0 Answers0