mirror of https://github.com/libAthena/athena.git
Use CMake MSVC_RUNTIME_LIBRARY to control MSVC flags
This commit is contained in:
parent
6c52de489f
commit
dec27c05ed
|
@ -1,4 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||||
|
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
||||||
|
cmake_policy(SET CMP0091 NEW)
|
||||||
project(athena)
|
project(athena)
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
|
@ -10,13 +10,6 @@ get_directory_property(ATDNA_DEFINES COMPILE_DEFINITIONS)
|
||||||
list(REMOVE_ITEM ATDNA_DEFINES _GLIBCXX_DEBUG=1)
|
list(REMOVE_ITEM ATDNA_DEFINES _GLIBCXX_DEBUG=1)
|
||||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${ATDNA_DEFINES}")
|
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${ATDNA_DEFINES}")
|
||||||
|
|
||||||
# Force this binary to /MD flags (to make MSVC happy)
|
|
||||||
if(MSVC)
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "/MD /Zi /Ob0 /Od /RTC1")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /DNDEBUG")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /O2 /Ob1 /DNDEBUG")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find dependencies
|
# Find dependencies
|
||||||
include(FindLLVM.cmake)
|
include(FindLLVM.cmake)
|
||||||
if(NOT LLVM_FOUND)
|
if(NOT LLVM_FOUND)
|
||||||
|
@ -147,7 +140,9 @@ set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS
|
||||||
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
|
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||||
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
|
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(atdna PRIVATE /GR-)
|
# Allow linking against release-built LLVM libraries
|
||||||
|
target_compile_options(atdna PRIVATE /GR- /D_ITERATOR_DEBUG_LEVEL=0)
|
||||||
|
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
||||||
else()
|
else()
|
||||||
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
||||||
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
if(NOT WIN32)
|
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
endif()
|
if(NOT ZLIB_FOUND)
|
||||||
if(WIN32 OR NOT ZLIB_FOUND)
|
|
||||||
message(STATUS "Using Athena's built-in zlib")
|
message(STATUS "Using Athena's built-in zlib")
|
||||||
add_library(z
|
add_library(z
|
||||||
adler32.c
|
adler32.c
|
||||||
|
|
Loading…
Reference in New Issue