summaryrefslogtreecommitdiff
path: root/configureoptimization.cmake
blob: dd26849a1b1ca20af188c3b8c1b6a11a86295dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if(WIN32)
    add_compile_options($<$<CONFIG:Debug>:/Od>)
    add_compile_options($<$<CONFIG:Checked>:/O1>)
    add_compile_options($<$<CONFIG:Release>:/Ox>)
    add_compile_options($<$<CONFIG:RelWithDebInfo>:/O2>)
elseif(CLR_CMAKE_PLATFORM_UNIX)
    set(CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK OFF)
    if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
        if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.9))
            set(CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK ON)
        endif()
    endif()
    add_compile_options($<$<CONFIG:Debug>:-O0>)
    if (CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK)
        add_compile_options($<$<NOT:$<CONFIG:Debug>>:-O1>)
    else()
        add_compile_options($<$<CONFIG:Checked>:-O2>)
        add_compile_options($<$<CONFIG:Release>:-O3>)
        add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
    endif()

endif()