Merge pull request #24891 from dotnet-maestro-bot/merge/master-to-release/3.0
[platform/upstream/coreclr.git] / configureoptimization.cmake
1 if(WIN32)
2     add_compile_options($<$<CONFIG:Debug>:/Od>)
3     add_compile_options($<$<CONFIG:Checked>:/O1>)
4     add_compile_options($<$<CONFIG:Release>:/Ox>)
5     add_compile_options($<$<CONFIG:RelWithDebInfo>:/O2>)
6 elseif(CLR_CMAKE_PLATFORM_UNIX)
7     set(CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK OFF)
8     if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
9         if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.9))
10             set(CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK ON)
11         endif()
12     endif()
13     add_compile_options($<$<CONFIG:Debug>:-O0>)
14     if (CLR_CMAKE_ARM_OPTIMIZATION_FALLBACK)
15         add_compile_options($<$<NOT:$<CONFIG:Debug>>:-O1>)
16     else()
17         add_compile_options($<$<CONFIG:Checked>:-O2>)
18         add_compile_options($<$<CONFIG:Release>:-O3>)
19         add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
20     endif()
21
22 endif()