CMakeLists: Migrate off directly modifying CMAKE_CXX_FLAGS

We can simply apply the compilation options directly to the target. We
can perform equivalent behavior for conditionally adding sources to the
target instead of assigning to a variable as well.
This commit is contained in:
Lioncash 2019-08-10 01:52:25 -04:00
parent ac6f2a1ed2
commit 876a2ccf81
1 changed files with 8 additions and 7 deletions

View File

@ -1,9 +1,3 @@
if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar")
set(PLAT_SRCS FileIOFILE.cpp)
else()
set(PLAT_SRCS FileIOWin32.cpp)
endif()
add_library(nod add_library(nod
aes.cpp aes.cpp
sha1.c sha1.c
@ -14,9 +8,16 @@ add_library(nod
DiscWii.cpp DiscWii.cpp
DirectoryEnumerator.cpp DirectoryEnumerator.cpp
nod.cpp nod.cpp
${PLAT_SRCS}
${NOD_HEADERS}) ${NOD_HEADERS})
target_link_libraries(nod PUBLIC logvisor) target_link_libraries(nod PUBLIC logvisor)
if(WIN32)
target_sources(nod PRIVATE FileIOWin32.cpp)
else()
target_compile_options(nod PRIVATE -Wno-multichar)
target_sources(nod PRIVATE FileIOFILE.cpp)
endif()
if(NOT MSVC AND NOT NX) if(NOT MSVC AND NOT NX)
set_source_files_properties(aes.cpp PROPERTIES COMPILE_FLAGS -maes) set_source_files_properties(aes.cpp PROPERTIES COMPILE_FLAGS -maes)
endif() endif()