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,7 +26,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
|
|||
|
||||
# Compiler flags
|
||||
if (MSVC)
|
||||
add_compile_options(/W4
|
||||
set(DYNARMIC_CXX_FLAGS
|
||||
/W4
|
||||
/w34263 # Non-virtual member function hides base class virtual function
|
||||
/w44265 # Class has virtual functions, but destructor is not virtual
|
||||
/w34456 # Declaration of 'var' hides previous local declaration
|
||||
|
@ -39,17 +40,19 @@ if (MSVC)
|
|||
/Zi
|
||||
/Zo
|
||||
/EHsc
|
||||
/WX)
|
||||
add_compile_options(/DNOMINMAX)
|
||||
/WX
|
||||
/DNOMINMAX)
|
||||
|
||||
if (CMAKE_VS_PLATFORM_TOOLSET MATCHES "LLVM-vs[0-9]+")
|
||||
add_compile_options(-Qunused-arguments
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
-Qunused-arguments
|
||||
-Wno-unused-parameter
|
||||
-Wno-missing-braces)
|
||||
add_compile_options(-Xclang -fno-operator-names)
|
||||
-Wno-missing-braces
|
||||
-Xclang -fno-operator-names)
|
||||
endif()
|
||||
else()
|
||||
add_compile_options(-Wall
|
||||
set(DYNARMIC_CXX_FLAGS
|
||||
-Wall
|
||||
-Werror
|
||||
-Wextra
|
||||
-Wcast-qual
|
||||
|
@ -57,11 +60,12 @@ else()
|
|||
-pedantic-errors
|
||||
-Wfatal-errors
|
||||
-Wno-unused-parameter
|
||||
-Wno-missing-braces)
|
||||
add_compile_options(-fno-operator-names)
|
||||
-Wno-missing-braces
|
||||
-fno-operator-names)
|
||||
|
||||
if (ARCHITECTURE_x86_64)
|
||||
add_compile_options(-msse3)
|
||||
list(APPEND DYNARMIC_CXX_FLAGS
|
||||
-msse3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -103,6 +103,8 @@ set_target_properties(dynarmic PROPERTIES LINKER_LANGUAGE CXX)
|
|||
target_include_directories(dynarmic
|
||||
PUBLIC ../include
|
||||
PRIVATE .)
|
||||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
|
||||
# Link fmt
|
||||
target_link_libraries(dynarmic PRIVATE fmt-header-only)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
|
|
|
@ -37,7 +37,7 @@ create_directory_groups(${SRCS} ${HEADERS})
|
|||
add_executable(dynarmic_tests ${SRCS})
|
||||
target_link_libraries(dynarmic_tests dynarmic ${llvm_libs})
|
||||
set_target_properties(dynarmic_tests PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_include_directories(dynarmic_tests
|
||||
PRIVATE . ../src)
|
||||
target_include_directories(dynarmic_tests PRIVATE . ../src)
|
||||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
|
||||
add_test(dynarmic_tests dynarmic_tests)
|
||||
|
|
Loading…
Reference in a new issue