# Feature request for PER\_FILE\_C\_OPT / PER\_FILE\_CXX\_OPT

**URL:** <https://discourse.cmake.org/t/feature-request-for-per-file-c-opt-per-file-cxx-opt/4228>\
**Category:** Development\
**Created:** [October 8, 2021, 7:55am UTC](https://discourse.cmake.org/t/feature-request-for-per-file-c-opt-per-file-cxx-opt/4228 "2021-10-08T07:55:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cycheng](https://discourse.cmake.org/user_avatar/discourse.cmake.org/cycheng/32/1860_2.png) [@cycheng](https://discourse.cmake.org/u/cycheng)\
**Post date:** [October 8, 2021, 7:55am UTC](https://discourse.cmake.org/t/feature-request-for-per-file-c-opt-per-file-cxx-opt/4228/1 "2021-10-08T07:55:17Z")

</div>

Hi,

When working on large codebase project, it would be very helpful if I can overwrite some files with different compiler option. For example, by default I was using Release to build the whole project, but when I want to debug some particular files, if I can use ‘-O0 -g’ only on those particular files instead of rebuild the whole project or submodule, it would save me a lot of rebuilding time and linking time (given that I have been using better linker).

I guess the feature will be similar to Bazel’s --per\_file\_copt?

Thanks!  
CY

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [October 8, 2021, 8:32am UTC](https://discourse.cmake.org/t/feature-request-for-per-file-c-opt-per-file-cxx-opt/4228/2 "2021-10-08T08:32:57Z")

</div>

Maybe: [set\_source\_files\_properties](https://cmake.org/cmake/help/latest/command/set_source_files_properties.html) with the right [properties](https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#source-file-properties)?

---

<div class="post-metadata">

**Author:** ![cycheng](https://discourse.cmake.org/user_avatar/discourse.cmake.org/cycheng/32/1860_2.png) [@cycheng](https://discourse.cmake.org/u/cycheng)\
**Post date:** [October 8, 2021, 9:22am UTC](https://discourse.cmake.org/t/feature-request-for-per-file-c-opt-per-file-cxx-opt/4228/3 "2021-10-08T09:22:41Z")

</div>

Cool! Thanks! That’s what I need 😄
