Skip to content

Commit

Permalink
Update CMAKE_LANG_FLAGS_CONFIG_INIT appending in toolchain to avoid f…
Browse files Browse the repository at this point in the history
…lag repetition (openvinotoolkit#27352)

### Details:
-Currently, when using this toolchain and print the following flags in
[CMakeLists](https://github.com/openvinotoolkit/openvino/blob/master/CMakeLists.txt)
```
CMAKE_CXX_FLAGS_RELEASE in OV CMakeLists.txt::: /MT /MT /O2 /Ob2 /DNDEBUG /Zi /FS /Zf /ZH:SHA_256 /guard:cf /Qspectre
CMAKE_C_FLAGS_RELEASE in OV CMakeLists.txt::: /MT /MT /O2 /Ob2 /DNDEBUG /Zi /FS /Zf /ZH:SHA_256 /guard:cf /Qspectre
CMAKE_CXX_FLAGS_RELEASE_INIT in OV CMakeLists.txt::: /MT /MT /O2 /Ob2 /DNDEBUG
CMAKE_C_FLAGS_RELEASE_INIT in OV CMakeLists.txt::: /MT /MT /O2 /Ob2 /DNDEBUG
```
So there is repetition of `/MT` in flags.
The change in this PR will fix this problem. The flags will be:

```
CMAKE_CXX_FLAGS_RELEASE in OV CMakeLists.txt::: /MT /O2 /Ob2 /DNDEBUG /Zi /FS /Zf /ZH:SHA_256 /guard:cf /Qspectre
CMAKE_C_FLAGS_RELEASE in OV CMakeLists.txt::: /MT /O2 /Ob2 /DNDEBUG /Zi /FS /Zf /ZH:SHA_256 /guard:cf /Qspectre
CMAKE_CXX_FLAGS_RELEASE_INIT in OV CMakeLists.txt::: /MT /O2 /Ob2 /DNDEBUG
CMAKE_C_FLAGS_RELEASE_INIT in OV CMakeLists.txt::: /MT /O2 /Ob2 /DNDEBUG
```

### Tickets:
 - *152927*

Signed-off-by: Kang Wenjing <[email protected]>
  • Loading branch information
WenjingKangIntel authored Oct 31, 2024
1 parent c685d44 commit f2640a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/toolchains/mt.runtime.win32.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ if(use_static_runtime)
set(flag_var "CMAKE_${lang}_FLAGS${build_type}_INIT")
string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
if (build_type STREQUAL "_DEBUG")
set(${flag_var} "${${flag_var}} /MTd")
set(${flag_var} "/MTd")
else()
set(${flag_var} "${${flag_var}} /MT")
set(${flag_var} "/MT")
endif()
endforeach()
endforeach()
Expand Down

0 comments on commit f2640a2

Please sign in to comment.