Search code examples
c++cclang

how to read compiler flags from a file


Is it possible to configure clang to read the compiler flags from a file. Is there any flag like:

 clang++ test.cpp -flags=flags-file

Such that clang reads the compiler flags from flags-file.


Solution

  • Apparently there is support for reading commands from a file in clang as well as in gcc. The usage is something like:

    clang++ test.cpp @file
    

    The compiler will read the command line flags from file.

    I could find a link for gcc. https://developer.apple.com/library/mac/documentation/darwin/reference/manpages/man1/gcc.1.html