mirror of
https://github.com/Vita3K/dynarmic.git
synced 2024-11-26 23:10:32 +00:00
CMake: Add option DYNARMIC_WARNINGS_AS_ERRORS
This commit is contained in:
parent
2af39dfaa8
commit
a77710e5cf
@ -1,10 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||
project(dynarmic CXX)
|
||||
|
||||
# Determine if we're built as a subproject (using add_subdirectory)
|
||||
# or if this is the master project.
|
||||
set(MASTER_PROJECT OFF)
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(MASTER_PROJECT ON)
|
||||
endif()
|
||||
|
||||
# Dynarmic project options
|
||||
option(DYNARMIC_USE_SYSTEM_BOOST "Use the system boost libraries" ON)
|
||||
option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)
|
||||
option(DYNARMIC_TESTS "Build tests" ON)
|
||||
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
|
||||
option(DYNARMIC_WARNINGS_AS_ERRORS "Warnings as errors" ${MASTER_PROJECT})
|
||||
|
||||
# Set hard requirements for C++
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
@ -40,9 +48,13 @@ if (MSVC)
|
||||
/Zi
|
||||
/Zo
|
||||
/EHsc
|
||||
/WX
|
||||
/DNOMINMAX)
|
||||
|
||||
if (DYNARMIC_WARNINGS_AS_ERRORS)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
/WX)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VS_PLATFORM_TOOLSET MATCHES "LLVM-vs[0-9]+")
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
-Qunused-arguments
|
||||
@ -53,7 +65,6 @@ if (MSVC)
|
||||
else()
|
||||
set(DYNARMIC_CXX_FLAGS
|
||||
-Wall
|
||||
-Werror
|
||||
-Wextra
|
||||
-Wcast-qual
|
||||
-pedantic
|
||||
@ -63,6 +74,11 @@ else()
|
||||
-Wno-missing-braces
|
||||
-fno-operator-names)
|
||||
|
||||
if (DYNARMIC_WARNINGS_AS_ERRORS)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
-Werror)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_x86_64)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
-msse3)
|
||||
|
Loading…
Reference in New Issue
Block a user