cmake: use CMAKE_BUILD_TYPE and default to Debug

Unlike hardcoded target_compile_options(-g) can be overriden from the
command line, from the parent ExternalProject_Add(CMAKE_ARGS) (tested)
or from a CMake GUI (not tested).

Default to Debug because the time spent running rimage is negligible
compared to building the image to sign and because the time saved
learning CMake when it crashes can be huge for some people.

BTW -O2 -g is rarely ever useful.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2020-06-15 21:59:30 -07:00 committed by Liam Girdwood
parent 9f3f2d7d71
commit 4348e2a2bd
1 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,11 @@ cmake_minimum_required(VERSION 3.10)
project(SOF_RIMAGE C)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No CMAKE_BUILD_TYPE, defaulting to Debug")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
endif()
add_executable(rimage
src/file_simple.c
src/man_apl.c
@ -23,7 +28,7 @@ add_executable(rimage
)
target_compile_options(rimage PRIVATE
-O2 -g -Wall -Werror -Wl,-EL -Wmissing-prototypes -Wimplicit-fallthrough=3
-Wall -Werror -Wl,-EL -Wmissing-prototypes -Wimplicit-fallthrough=3
)
target_link_libraries(rimage PRIVATE "-lcrypto")