mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-01 00:22:55 +08:00
e2049cb975
* [vcpkg_configure_cmake] Add NO_CHARSET_FLAG option * [vcpkg_configure_cmake] Add documentation for new NO_CHARSET_FLAG option * [vcpkg_configure_cmake, windows toolchain] Handle NO_CHARSET_FLAG in toolchain * [build.cpp] Add Windows toolchain to package hash * [duilib,msix,thrift,tidy-html5] Use NO_CHARSET_FLAG to fix regressions
32 lines
1.7 KiB
CMake
32 lines
1.7 KiB
CMake
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()
|
|
|
|
set(CHARSET_FLAG "/utf-8")
|
|
if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
|
# VS 2013 does not support /utf-8
|
|
set(CHARSET_FLAG)
|
|
endif()
|
|
|
|
set(CMAKE_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "")
|
|
set(CMAKE_C_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "")
|
|
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "")
|
|
|
|
unset(CHARSET_FLAG)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "")
|
|
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "")
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "")
|
|
set(CMAKE_C_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "")
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "")
|
|
endif()
|