cc-rs
cc-rs copied to clipboard
Add independent flags to C or C++ files
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:
- Add
Build::c_flag()andBuild::cpp_flag()methods to add independent flags to C or C++ files. - Add
srcargument toTool::to_command()method to auto-detect c/cpp compiler by source file extension for Clang/Gnu toolset.