[llvm] [cmake] Optimize RelWithDebInfo compiler options on windows (PR #101533)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 04:20:10 PDT 2024


zmodem wrote:

> > This patch seems brittle though. What if LLVM's regular Release flags change, how do we ensure that CMAKE_CXX_FLAGS_RELWITHDEBINFO is kept in sync?
> > Could we define CMAKE_CXX_FLAGS_RELWITHDEBINFO to be CMAKE_CXX_FLAGS_RELEASE + debug flags somewhere?
> 
> Sure, we can overwrite RELWITHDEBINFO based on the CMAKE_CXX_FLAGS_RELEASE flags like this
> 
> ```
>   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
>   set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
>   set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
> ```

Shouldn't the `LINKER_FLAGS_RELEASE` variables already include the `/OPT:` flags?

> 
> and do we need to add some additional flags for FLAGS_RELEASE, such as /FIXED:NO

Why?

https://github.com/llvm/llvm-project/pull/101533


More information about the llvm-commits mailing list