31 lines
1.2 KiB
CMake
31 lines
1.2 KiB
CMake
include(CheckIPOSupported)
|
|
|
|
function(SetOptimisationSettings)
|
|
check_ipo_supported(RESULT result)
|
|
if(result)
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE PARENT_SCOPE)
|
|
endif ()
|
|
|
|
if (LINUX)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native" PARENT_SCOPE)
|
|
elseif (APPLE)
|
|
add_compile_options("$<$<CONFIG:Release>:-O3>$<$<CONFIG:Debug>:-O0>$<$<CONFIG:MinSizeRel>:-Os>$<$<CONFIG:RelWithDebInfo>:-O2>")
|
|
set(CMAKE_Swift_FLAGS_DEBUG "-Onone" PARENT_SCOPE)
|
|
set(CMAKE_Swift_FLAGS_RELEASE "-O" PARENT_SCOPE)
|
|
set(CMAKE_Swift_FLAGS_MINSIZEREL "-Osize" PARENT_SCOPE)
|
|
endif ()
|
|
endfunction()
|
|
|
|
function(SetWarningSettings TARGET)
|
|
if (LINUX)
|
|
target_compile_options(${TARGET} PRIVATE -Wall -Wno-unknown-pragmas)
|
|
elseif (WIN32)
|
|
if (MSVC)
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
add_compile_options(/wd4068)
|
|
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "/wd4068")
|
|
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "/we4715")
|
|
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/ignore:4099")
|
|
endif()
|
|
endif()
|
|
endfunction() |