diff options
Diffstat (limited to 'configureoptimization.cmake')
-rw-r--r-- | configureoptimization.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/configureoptimization.cmake b/configureoptimization.cmake new file mode 100644 index 0000000000..ad9f4a4907 --- /dev/null +++ b/configureoptimization.cmake @@ -0,0 +1,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}" STREQUAL "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() |