visigen/CMakeLists: Modify target directly

Instead of using variables, we can directly specify our requirements on
the target instance directly. This also avoids modifying
CMAKE_CXX_FLAGS.
This commit is contained in:
Lioncash 2019-09-06 07:50:15 -04:00
parent fea7984f71
commit d5d176d1a5
1 changed files with 31 additions and 13 deletions

View File

@ -5,33 +5,51 @@ project(visigen)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(visigen
VISIBuilder.cpp
VISIBuilder.hpp
VISIRenderer.cpp
VISIRenderer.hpp
)
if(MSVC) if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") target_compile_options(visigen PRIVATE /EHsc)
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}\ target_compile_options(visigen PRIVATE
-Wno-multichar -fno-exceptions -Wno-narrowing -Wno-nullability-completeness -Werror=return-type") -fno-exceptions
-Werror=return-type
-Wno-multichar
-Wno-narrowing
-Wno-nullability-completeness
)
endif() endif()
if(APPLE) if(APPLE)
set(PLAT_SRCS MainMac.mm) target_sources(visigen PRIVATE MainMac.mm)
set_source_files_properties(MainMac.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) set_source_files_properties(MainMac.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
elseif(WIN32) elseif(WIN32)
set(PLAT_SRCS MainWin.cpp) target_sources(visigen PRIVATE MainWin.cpp)
else() else()
set(PLAT_SRCS MainXlib.cpp) target_sources(visigen PRIVATE MainXlib.cpp)
endif() endif()
add_executable(visigen ${PLAT_SRCS}
VISIRenderer.cpp VISIRenderer.hpp
VISIBuilder.cpp VISIBuilder.hpp)
set_target_properties(visigen PROPERTIES COMPILE_DEFINITIONS URDE_DLPACKAGE="${URDE_DLPACKAGE}") set_target_properties(visigen PROPERTIES COMPILE_DEFINITIONS URDE_DLPACKAGE="${URDE_DLPACKAGE}")
if(APPLE) if(APPLE)
find_library(OPENGL_LIBRARY OpenGL) find_library(OPENGL_LIBRARY OpenGL)
set(PLAT_LIBS ${OPENGL_LIBRARY}) target_link_libraries(visigen PRIVATE ${OPENGL_LIBRARY})
endif() endif()
target_link_libraries(visigen logvisor athena-core zeus glew target_link_libraries(visigen PRIVATE
xxhash ${ZLIB_LIBRARIES} lzokay hecl-light ${PLAT_LIBS}) athena-core
glew
hecl-light
logvisor
lzokay
xxhash
zeus
${ZLIB_LIBRARIES}
)
endif() endif()