squash - Don't set CMAKE_CXX_FLAGS and let CMAKE_MSVC_RUNTIME_LIBRARY do it for us

This commit is contained in:
Michael Savage 2022-02-07 23:40:04 +02:00
parent 1ae3f90ad0
commit 965dc94899

View file

@ -5,17 +5,20 @@ if(EXT_PLATFORM_STRING)
endif() endif()
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(Luau LANGUAGES CXX C)
option(LUAU_BUILD_CLI "Build CLI" ON) option(LUAU_BUILD_CLI "Build CLI" ON)
option(LUAU_BUILD_TESTS "Build tests" ON) option(LUAU_BUILD_TESTS "Build tests" ON)
option(LUAU_BUILD_WEB "Build Web module" OFF) option(LUAU_BUILD_WEB "Build Web module" OFF)
option(LUAU_WERROR "Warnings as errors" OFF) option(LUAU_WERROR "Warnings as errors" OFF)
if(MSVC)
option(LUAU_STATIC_CRT "Link with the static CRT (/MT)" OFF) option(LUAU_STATIC_CRT "Link with the static CRT (/MT)" OFF)
if(LUAU_STATIC_CRT)
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif() endif()
project(Luau LANGUAGES CXX C)
add_library(Luau.Ast STATIC) add_library(Luau.Ast STATIC)
add_library(Luau.Compiler STATIC) add_library(Luau.Compiler STATIC)
add_library(Luau.Analysis STATIC) add_library(Luau.Analysis STATIC)
@ -64,12 +67,6 @@ set(LUAU_OPTIONS)
if(MSVC) if(MSVC)
list(APPEND LUAU_OPTIONS /D_CRT_SECURE_NO_WARNINGS) # We need to use the portable CRT functions. list(APPEND LUAU_OPTIONS /D_CRT_SECURE_NO_WARNINGS) # We need to use the portable CRT functions.
list(APPEND LUAU_OPTIONS /MP) # Distribute single project compilation across multiple cores list(APPEND LUAU_OPTIONS /MP) # Distribute single project compilation across multiple cores
if(LUAU_STATIC_CRT)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()
else() else()
list(APPEND LUAU_OPTIONS -Wall) # All warnings list(APPEND LUAU_OPTIONS -Wall) # All warnings
endif() endif()