forked from qbittorrent/qBittorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As of this commit, L98 of winconf.cmake already checks for MSVC before winconf-msvc calls this macro, so we are guaranteed to be satisfy the check.
- Loading branch information
1 parent
9f9868b
commit b7f2122
Showing
1 changed file
with
32 additions
and
34 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,38 +1,36 @@ | ||
macro(configure_msvc_runtime) | ||
if(MSVC) | ||
# Default to statically-linked runtime. | ||
if("${MSVC_RUNTIME}" STREQUAL "") | ||
set(MSVC_RUNTIME "static") | ||
endif() | ||
# Set compiler options. | ||
set(variables | ||
CMAKE_C_FLAGS_DEBUG | ||
CMAKE_C_FLAGS_MINSIZEREL | ||
CMAKE_C_FLAGS_RELEASE | ||
CMAKE_C_FLAGS_RELWITHDEBINFO | ||
CMAKE_CXX_FLAGS_DEBUG | ||
CMAKE_CXX_FLAGS_MINSIZEREL | ||
CMAKE_CXX_FLAGS_RELEASE | ||
CMAKE_CXX_FLAGS_RELWITHDEBINFO | ||
# Default to statically-linked runtime. | ||
if("${MSVC_RUNTIME}" STREQUAL "") | ||
set(MSVC_RUNTIME "static") | ||
endif() | ||
# Set compiler options. | ||
set(variables | ||
CMAKE_C_FLAGS_DEBUG | ||
CMAKE_C_FLAGS_MINSIZEREL | ||
CMAKE_C_FLAGS_RELEASE | ||
CMAKE_C_FLAGS_RELWITHDEBINFO | ||
CMAKE_CXX_FLAGS_DEBUG | ||
CMAKE_CXX_FLAGS_MINSIZEREL | ||
CMAKE_CXX_FLAGS_RELEASE | ||
CMAKE_CXX_FLAGS_RELWITHDEBINFO | ||
) | ||
if(${MSVC_RUNTIME} STREQUAL "static") | ||
message(STATUS | ||
"MSVC -> forcing use of statically-linked runtime." | ||
) | ||
foreach(variable ${variables}) | ||
if(${variable} MATCHES "/MD") | ||
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}") | ||
endif() | ||
endforeach() | ||
else() | ||
message(STATUS | ||
"MSVC -> forcing use of dynamically-linked runtime." | ||
) | ||
if(${MSVC_RUNTIME} STREQUAL "static") | ||
message(STATUS | ||
"MSVC -> forcing use of statically-linked runtime." | ||
) | ||
foreach(variable ${variables}) | ||
if(${variable} MATCHES "/MD") | ||
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}") | ||
endif() | ||
endforeach() | ||
else() | ||
message(STATUS | ||
"MSVC -> forcing use of dynamically-linked runtime." | ||
) | ||
foreach(variable ${variables}) | ||
if(${variable} MATCHES "/MT") | ||
string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}") | ||
endif() | ||
endforeach() | ||
endif() | ||
foreach(variable ${variables}) | ||
if(${variable} MATCHES "/MT") | ||
string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}") | ||
endif() | ||
endforeach() | ||
endif() | ||
endmacro() |