[PATCH] D151613: Do not set CMAKE_CXX_FLAGS_<config> with FORCE

Artemy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 27 07:59:49 PDT 2023


ArtemSkrebkov created this revision.
Herald added a project: All.
ArtemSkrebkov requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Updating CMAKE_CXX_FLAGS_RELEASE (with CACHE FORCE) forces
to re-initialize it each time with a new value taken from cache.

In my project , it leads to CMAKE_CXX_FLAGS_RELEASE like this /MD /O2 <https://reviews.llvm.org/owners/package/2/>
/Ob2 /DNDEBUG  /sdl /guard:cf /wd4996 /wd4146 /wd4703 /wd4996 /wd4146
/wd4703 /wd4996 /wd4146 /wd4703 /wd4996 /wd4146 /wd4703 repeating flags
again.

The consequences of this is that the project has to be rebuilt from
scratch every time you call cmake configure.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151613

Files:
  llvm/cmake/modules/ChooseMSVCCRT.cmake


Index: llvm/cmake/modules/ChooseMSVCCRT.cmake
===================================================================
--- llvm/cmake/modules/ChooseMSVCCRT.cmake
+++ llvm/cmake/modules/ChooseMSVCCRT.cmake
@@ -43,11 +43,7 @@
     string(REGEX REPLACE "${${regex}}" "${${flag}}" ${flagsvar} "${${flagsvar}}")
   endif()
   string(STRIP "${${flagsvar}}" ${flagsvar})
-  # Make sure this change gets reflected in the cache/gui.
-  # CMake requires the docstring parameter whenever set() touches the cache,
-  # so get the existing docstring and re-use that.
-  get_property(flagsvar_docs CACHE ${flagsvar} PROPERTY HELPSTRING)
-  set(${flagsvar} "${${flagsvar}}" CACHE STRING "${flagsvar_docs}" FORCE)
+  set(${flagsvar} "${${flagsvar}}")
 endmacro(set_flag_in_var)
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151613.526269.patch
Type: text/x-patch
Size: 761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230527/686c8357/attachment.bin>


More information about the llvm-commits mailing list