1

I am writing a CMake file to generate Makefiles for an Atmel Project.

The problem I have is that when building in Atmel studio, the options -MF <filname> and -MT"<filename>" are used. For atmel, these filenames are dependent on the input file, so eg. for file foo.c the flags will be set to

-MF "<path>/foo.d" -MT"<path>/foo.d"

How can I have the same behaviour from a CMake Project? What I basically want is below row but where foo is replaced with currently compiling file so it is replaced with bar.d, baz.d et.c.

target_compile_options (foo_project PRIVATE -MD -MP -MF "<path>/foo.d" -MT"<path>/foo.d")

hope I make somewhat sense...

thanks

Johan
  • 1,633
  • 15
  • 22
  • What does MF/MT do? What compiler is this? Please add more information. –  Nov 10 '20 at 16:13
  • Don’t really see the relevance of that information given the question but ok, the compiler is arm-none-eabi-gcc 6.3.1 , that is atmels C compiler. What the flags does I have no idea – Johan Nov 10 '20 at 17:38
  • 1
    According to [gcc documentation](https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html), both `-MF` and `-MT` options are used for create file with header dependencies for use this file in a Makefile. Since CMake by itsef generates Makefile(s) and tracks needed dependencies, you don't need to use these options. – Tsyvarev Nov 11 '20 at 08:09
  • Thanks, solves my immediate problem, but question still remains whether it is possible or not – Johan Nov 12 '20 at 11:30

0 Answers0