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) 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) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)

View File

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