No optimization flags to remill_settings and default CMAKE_BUILD_TYPE=Debug

This commit is contained in:
Duncan Ogilvie
2025-10-31 01:45:32 +01:00
committed by Kyle Elliott
parent 4bc1b54d6d
commit 658a1806a7
3 changed files with 10 additions and 7 deletions
+1 -7
View File
@@ -190,22 +190,16 @@ else()
# debug symbols
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
target_compile_options(remill_settings INTERFACE
-gdwarf-2 -g3
-g3
)
endif()
# optimization flags and definitions
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(remill_settings INTERFACE
-O0
)
target_compile_definitions(remill_settings INTERFACE
"DEBUG"
)
else()
target_compile_options(remill_settings INTERFACE
-O2
)
target_compile_definitions(remill_settings INTERFACE
"NDEBUG"
)
+6
View File
@@ -1,6 +1,12 @@
# This is only executed once; use a macro (and not a function) so that
# everything defined here does not end up in a separate namespace
macro(main)
# Set default build type to Debug for single-config generators
if(NOT CMAKE_BUILD_TYPE AND NOT GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
message(STATUS "CMAKE_BUILD_TYPE not specified, defaulting to Debug")
endif()
# overwrite the default install prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(DEFINED WIN32)
+3
View File
@@ -62,6 +62,9 @@ function(COMPILE_X86_TESTS name address_size has_avx has_avx512)
target_link_libraries(run-${name}-tests PUBLIC remill GTest::gtest)
target_compile_definitions(run-${name}-tests PUBLIC ${PROJECT_DEFINITIONS})
# Without optimizations the tests take infinitely long
target_compile_options(run-${name}-tests PRIVATE $<$<CONFIG:Debug>:-O2>)
target_compile_options(run-${name}-tests
PRIVATE ${X86_TEST_FLAGS}
)