freerdp: fix build warnings with MSVC

This commit is contained in:
Marc-André Moreau 2013-07-26 15:21:19 -04:00
parent 03a401b8e6
commit 1307026a94
2 changed files with 28 additions and 6 deletions

View File

@ -160,10 +160,10 @@ endif()
if(MSVC) if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MD") #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2") #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /O2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ob2") #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ob2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2")
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_AMD64_") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_AMD64_")
else() else()

View File

@ -5,17 +5,20 @@ macro(configure_msvc_runtime)
if("${MSVC_RUNTIME}" STREQUAL "") if("${MSVC_RUNTIME}" STREQUAL "")
set(MSVC_RUNTIME "dynamic") set(MSVC_RUNTIME "dynamic")
endif() endif()
# Set compiler options. # Set compiler options.
set(variables set(variables
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
)
if(${MSVC_RUNTIME} STREQUAL "static") if(${MSVC_RUNTIME} STREQUAL "static")
message(STATUS "MSVC: using statically-linked runtime (/MT and /MTd).") message(STATUS "MSVC: using statically-linked runtime (/MT and /MTd).")
foreach(variable ${variables}) foreach(variable ${variables})
@ -31,6 +34,25 @@ macro(configure_msvc_runtime)
endif() endif()
endforeach() endforeach()
endif() endif()
foreach(variable ${variables})
if(${variable} MATCHES "/Ob0")
string(REGEX REPLACE "/Ob0" "/Ob2" ${variable} "${${variable}}")
endif()
endforeach()
foreach(variable ${variables})
if(${variable} MATCHES "/W3")
string(REGEX REPLACE "/W3" "/W2" ${variable} "${${variable}}")
endif()
endforeach()
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
foreach(variable ${variables}) foreach(variable ${variables})
set(${variable} "${${variable}}" CACHE STRING "MSVC_${variable}" FORCE) set(${variable} "${${variable}}" CACHE STRING "MSVC_${variable}" FORCE)
endforeach() endforeach()