CMakeLists: Use target_compile_options intead of add_compile_options
This commit is contained in:
parent
74a95ea51e
commit
cc58666c06
3 changed files with 38 additions and 32 deletions
|
@ -26,42 +26,46 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
add_compile_options(/W4
|
set(DYNARMIC_CXX_FLAGS
|
||||||
/w34263 # Non-virtual member function hides base class virtual function
|
/W4
|
||||||
/w44265 # Class has virtual functions, but destructor is not virtual
|
/w34263 # Non-virtual member function hides base class virtual function
|
||||||
/w34456 # Declaration of 'var' hides previous local declaration
|
/w44265 # Class has virtual functions, but destructor is not virtual
|
||||||
/w34457 # Declaration of 'var' hides function parameter
|
/w34456 # Declaration of 'var' hides previous local declaration
|
||||||
/w34458 # Declaration of 'var' hides class member
|
/w34457 # Declaration of 'var' hides function parameter
|
||||||
/w34459 # Declaration of 'var' hides global definition
|
/w34458 # Declaration of 'var' hides class member
|
||||||
/w34946 # Reinterpret-cast between related types
|
/w34459 # Declaration of 'var' hides global definition
|
||||||
/wd4592 # Symbol will be dynamically initialized (implementation limitation)
|
/w34946 # Reinterpret-cast between related types
|
||||||
/MP
|
/wd4592 # Symbol will be dynamically initialized (implementation limitation)
|
||||||
/Zi
|
/MP
|
||||||
/Zo
|
/Zi
|
||||||
/EHsc
|
/Zo
|
||||||
/WX)
|
/EHsc
|
||||||
add_compile_options(/DNOMINMAX)
|
/WX
|
||||||
|
/DNOMINMAX)
|
||||||
|
|
||||||
if (CMAKE_VS_PLATFORM_TOOLSET MATCHES "LLVM-vs[0-9]+")
|
if (CMAKE_VS_PLATFORM_TOOLSET MATCHES "LLVM-vs[0-9]+")
|
||||||
add_compile_options(-Qunused-arguments
|
list(APPEND DYNARMIC_CXX_FLAGS
|
||||||
-Wno-unused-parameter
|
-Qunused-arguments
|
||||||
-Wno-missing-braces)
|
-Wno-unused-parameter
|
||||||
add_compile_options(-Xclang -fno-operator-names)
|
-Wno-missing-braces
|
||||||
|
-Xclang -fno-operator-names)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Wall
|
set(DYNARMIC_CXX_FLAGS
|
||||||
-Werror
|
-Wall
|
||||||
-Wextra
|
-Werror
|
||||||
-Wcast-qual
|
-Wextra
|
||||||
-pedantic
|
-Wcast-qual
|
||||||
-pedantic-errors
|
-pedantic
|
||||||
-Wfatal-errors
|
-pedantic-errors
|
||||||
-Wno-unused-parameter
|
-Wfatal-errors
|
||||||
-Wno-missing-braces)
|
-Wno-unused-parameter
|
||||||
add_compile_options(-fno-operator-names)
|
-Wno-missing-braces
|
||||||
|
-fno-operator-names)
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86_64)
|
||||||
add_compile_options(-msse3)
|
list(APPEND DYNARMIC_CXX_FLAGS
|
||||||
|
-msse3)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,8 @@ set_target_properties(dynarmic PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
target_include_directories(dynarmic
|
target_include_directories(dynarmic
|
||||||
PUBLIC ../include
|
PUBLIC ../include
|
||||||
PRIVATE .)
|
PRIVATE .)
|
||||||
|
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||||
|
|
||||||
# Link fmt
|
# Link fmt
|
||||||
target_link_libraries(dynarmic PRIVATE fmt-header-only)
|
target_link_libraries(dynarmic PRIVATE fmt-header-only)
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
|
|
@ -37,7 +37,7 @@ create_directory_groups(${SRCS} ${HEADERS})
|
||||||
add_executable(dynarmic_tests ${SRCS})
|
add_executable(dynarmic_tests ${SRCS})
|
||||||
target_link_libraries(dynarmic_tests dynarmic ${llvm_libs})
|
target_link_libraries(dynarmic_tests dynarmic ${llvm_libs})
|
||||||
set_target_properties(dynarmic_tests PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(dynarmic_tests PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
target_include_directories(dynarmic_tests
|
target_include_directories(dynarmic_tests PRIVATE . ../src)
|
||||||
PRIVATE . ../src)
|
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||||
|
|
||||||
add_test(dynarmic_tests dynarmic_tests)
|
add_test(dynarmic_tests dynarmic_tests)
|
||||||
|
|
Loading…
Reference in a new issue