# Using optimization flags with \`CC\` (PrgEnv-gnu)

**URL:** https://discourse.cmake.org/t/using-optimization-flags-with-cc-prgenv-gnu/13642
**Category:** Usage
**Tags:** os:linux, gen:makefiles
**Created:** [February 26, 2025, 9:25pm UTC](https://discourse.cmake.org/t/using-optimization-flags-with-cc-prgenv-gnu/13642 "2025-02-26T21:25:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wme7](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wme7/32/3336_2.png) [@wme7](https://discourse.cmake.org/u/wme7)
#### Post date: [February 26, 2025, 9:25pm UTC](https://discourse.cmake.org/t/using-optimization-flags-with-cc-prgenv-gnu/13642/1 "2025-02-26T21:25:52Z")

</div>

Nob questions here:  
I recall during my HPE training that **Cray Compilers Wrappers** automatically pass architecture-specific flags to the underlying (`gcc`, `clang` or `intel`) compilers.  
But I came cross some examples with CMakeLists including `-march=native` or `-mtune=native` flags with `CC` (PrgEnv-gnu).  
My questions are:

- Is it allowed? (perhaps only for PrgEnv-gnu)
- Is it effective? (perhaps is redundant)
- or could it be an error? (and CMake or Cray Wrappers ignores this flags?)
