Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #9668 from leoetlino/windows-cmake-fixes
CMake: minor Windows fixes
- Loading branch information
Showing
3 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
| foreach(f CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO) | ||
| if("${${f}}" MATCHES "/Zi") | ||
| string(REGEX REPLACE "/Zi" "/Z7" "${f}" "${${f}}") | ||
| endif() | ||
| endforeach() | ||
| endif() | ||
| # The default MSVC flags for Release and RelWithDebInfo are poorly chosen | ||
| # (see issue https://gitlab.kitware.com/cmake/cmake/-/issues/20812) | ||
| # By default, inlining is disabled for RelWithDebInfo. | ||
| # Manually redefine MSVC flags to match Visual Studio defaults | ||
| # and ensure that Release builds generate debug info. | ||
| foreach(f CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELEASE) | ||
| # optimize, define NDEBUG, generate debug info | ||
| set(${f} "/O2 /DNDEBUG /Z7") | ||
| endforeach() | ||
| endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters