mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
add basic cmake support
This commit is contained in:
parent
238a925000
commit
6d2a0ae83b
26 changed files with 1242 additions and 0 deletions
38
cmake/Modules/MacroConfigureMSVCRuntime.cmake
Normal file
38
cmake/Modules/MacroConfigureMSVCRuntime.cmake
Normal file
|
@ -0,0 +1,38 @@
|
|||
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
|
||||
)
|
||||
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()
|
||||
endif()
|
||||
endmacro()
|
Loading…
Add table
Add a link
Reference in a new issue