cc-rs icon indicating copy to clipboard operation
cc-rs copied to clipboard

Add independent flags to C or C++ files

Open varphone opened this issue 1 year ago • 0 comments

This PR introduces a new feature for C/C++ flags, primarily to support the compilation of mixed C/C++ code.

Sometimes we use both C and C++ languages in a single project. However, the compilers for C and C++ are different, so we need to specify different compilers during compilation. This PR adds independent compiler flags for C and C++ files, allowing us to specify different compilers during compilation.

The main changes in this PR are as follows:

  1. Add Build::c_flag() and Build::cpp_flag() methods to add independent flags to C or C++ files.
  2. Add src argument to Tool::to_command() method to auto-detect c/cpp compiler by source file extension for Clang/Gnu toolset.

varphone avatar Mar 28 '24 01:03 varphone