Skip to content

Commit

Permalink
wrap CMP0091 in MSVC check (#1580)
Browse files Browse the repository at this point in the history
  • Loading branch information
danewalton authored Feb 11, 2021
1 parent c1e482d commit da74369
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "")
endif()

# Use the static runtime libraries when building statically for consistency with vcpkg's
# arch-windows-static triplets:
cmake_policy(SET CMP0091 NEW) # https://cmake.org/cmake/help/v3.15/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

project(az LANGUAGES C)
enable_testing ()

Expand Down
6 changes: 6 additions & 0 deletions eng/cmake/global_compile_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ if(MSVC)
endif()

add_compile_options(/W4 ${WARNINGS_AS_ERRORS_FLAG} /wd5031 /wd4668 /wd4820 /wd4255 /wd4710 /analyze)

add_compile_options(
$<$<CONFIG:>:/MT> #---------|
$<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
$<$<CONFIG:Release>:/MT> #--|
)
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(WARNINGS_AS_ERRORS)
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
Expand Down

0 comments on commit da74369

Please sign in to comment.