Use CMAKE_MSVC_RUNTIME_LIBRARY on Windows

This commit is contained in:
Luke Street 2020-06-13 17:26:28 -04:00
parent f1f178df40
commit c31f79066c
2 changed files with 76 additions and 73 deletions

View File

@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
# Allow target_link_libraries with targets in other directories
cmake_policy(SET CMP0079 NEW)
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)

View File

@ -12,25 +12,20 @@
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_PREFIX_PATH",
"value": "C:\\Qt\\5.14.2\\msvc2017_64",
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "-m64 -fdiagnostics-absolute-paths",
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "-m64 -fdiagnostics-absolute-paths",
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreadedDebug",
"type": "STRING"
},
{
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
@ -42,22 +37,17 @@
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER_AR",
"name": "CMAKE_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER_RANLIB",
"name": "CMAKE_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"type": "FILEPATH"
}
@ -67,33 +57,28 @@
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "clang_cl_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64" ],
"variables": [
{
"name": "CMAKE_PREFIX_PATH",
"value": "C:\\Qt\\5.14.2\\msvc2017_64",
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "-m64 -fdiagnostics-absolute-paths",
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "-m64 -fdiagnostics-absolute-paths",
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreaded",
"type": "STRING"
},
{
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER",
"value": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe",
@ -105,55 +90,22 @@
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"name": "CMAKE_LINKER",
"value": "C:\\Program Files\\LLVM\\bin\\lld-link.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER_AR",
"name": "CMAKE_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER_AR",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ar.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_COMPILER_RANLIB",
"name": "CMAKE_RANLIB",
"value": "C:\\Program Files\\LLVM\\bin\\llvm-ranlib.exe",
"type": "FILEPATH"
}
]
},
{
"name": "x64-MSVC-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64" ],
"variables": [
{
"name": "CMAKE_PREFIX_PATH",
"value": "C:\\Qt\\5.14.2\\msvc2017_64",
"type": "FILEPATH"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "",
"type": "STRING"
}
]
},
{
"name": "x64-MSVC-Debug",
"generator": "Ninja",
@ -163,13 +115,61 @@
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64" ],
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_PREFIX_PATH",
"value": "C:\\Qt\\5.14.2\\msvc2017_64",
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreadedDebug",
"type": "STRING"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "",
"type": "STRING"
},
{
"name": "CMAKE_C_FLAGS",
"value": "",
"type": "STRING"
}
]
},
{
"name": "x64-MSVC-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake",
"type": "FILEPATH"
},
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "CMAKE_MSVC_RUNTIME_LIBRARY",
"value": "MultiThreaded",
"type": "STRING"
},
{
"name": "CMAKE_CXX_FLAGS",
"value": "",