- fixes for CMakeLists

This commit is contained in:
Dmytro Bogovych 2023-06-23 11:42:10 +03:00
parent ace77323d2
commit 978079fd55
3 changed files with 7 additions and 49 deletions

View File

@ -1,53 +1,7 @@
project(rtphone) project(rtphone)
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.10)
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
"rtphone: 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
"rtphone: 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})
string(REGEX REPLACE "/Z[iI7]" ""
${variable}
"${${variable}}")
set(${variable} "${${variable}} /Zi /Oy-")
endforeach()
endif()
endmacro()
# Rely on C++ 17 # Rely on C++ 17
@ -225,4 +179,4 @@ target_include_directories(rtphone
) )
# For MSVC static builds # For MSVC static builds
configure_msvc_runtime() set_property(TARGET rtphone PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

View File

@ -17,3 +17,7 @@ set_property(TARGET helper_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<C
# Private include directories # Private include directories
target_include_directories(helper_lib PUBLIC ../../libs/ ../../engine ../ .) target_include_directories(helper_lib PUBLIC ../../libs/ ../../engine ../ .)
target_compile_definitions(helper_lib PRIVATE -D_CRT_SECURE_NO_WARNINGS -D_UNICODE) target_compile_definitions(helper_lib PRIVATE -D_CRT_SECURE_NO_WARNINGS -D_UNICODE)
if (NOT USE_NULL_UUID)
target_link_libraries(helper_lib PUBLIC uuid)
endif()

@ -1 +1 @@
Subproject commit 9dc0b516ad67fd5d34b7dab694f5b884af44a1fc Subproject commit 34425a748bcad9235b58f97da25577947c501844