2020-03-13 19:23:11 +01:00
|
|
|
if(NOT _VCPKG_WINDOWS_TOOLCHAIN)
|
|
|
|
set(_VCPKG_WINDOWS_TOOLCHAIN 1)
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<STREQUAL:${VCPKG_CRT_LINKAGE},dynamic>:DLL>" CACHE STRING "")
|
|
|
|
|
2018-03-06 09:57:37 -08:00
|
|
|
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
|
|
|
if(NOT _CMAKE_IN_TRY_COMPILE)
|
|
|
|
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD")
|
|
|
|
elseif(VCPKG_CRT_LINKAGE STREQUAL "static")
|
|
|
|
set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
|
|
|
|
endif()
|
|
|
|
|
2019-06-30 09:31:22 -07:00
|
|
|
set(CHARSET_FLAG "/utf-8")
|
|
|
|
if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
2018-04-02 20:40:25 -07:00
|
|
|
# VS 2013 does not support /utf-8
|
|
|
|
set(CHARSET_FLAG)
|
|
|
|
endif()
|
|
|
|
|
2020-03-25 21:46:37 +01:00
|
|
|
set(CMAKE_CXX_FLAGS_INIT " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "")
|
|
|
|
set(CMAKE_C_FLAGS_INIT " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "")
|
|
|
|
set(CMAKE_RC_FLAGS_INIT "-c65001 /DWIN32" CACHE STRING "")
|
2019-06-30 09:31:22 -07:00
|
|
|
|
2018-04-02 20:40:25 -07:00
|
|
|
unset(CHARSET_FLAG)
|
2018-03-06 09:57:37 -08:00
|
|
|
|
2020-03-25 21:46:37 +01:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE_INIT "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE_INIT "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "")
|
2018-03-06 09:57:37 -08:00
|
|
|
|
2020-03-25 21:46:37 +01:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "")
|
2018-03-06 09:57:37 -08:00
|
|
|
endif()
|
2020-03-13 19:23:11 +01:00
|
|
|
endif()
|