diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-07-06 17:47:09 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-15 18:22:47 +0200 |
commit | ef1911a24f02aae1c9b16bff7ee1349832878ced (patch) | |
tree | 3b22e8d73643b4052d6c0fca35b4792c321f530c /cmake/cmake.d/04-build_options.cmake | |
parent | 611213e3740f6184e5ec894a1d537dd61eee69bd (diff) |
Fix: Yocto cross compile flag same the last commit
Change-Id: Id39653e23fddedd3f48a64d1d9badd6c7a1ef894
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/cmake.d/04-build_options.cmake')
-rw-r--r-- | cmake/cmake.d/04-build_options.cmake | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/cmake/cmake.d/04-build_options.cmake b/cmake/cmake.d/04-build_options.cmake index aacad64..266c4c1 100644 --- a/cmake/cmake.d/04-build_options.cmake +++ b/cmake/cmake.d/04-build_options.cmake @@ -72,15 +72,20 @@ add_compile_options(-Werror=implicit-function-declaration) add_compile_options(-ffunction-sections -fdata-sections) add_compile_options(-fPIC) -set(CMAKE_C_FLAGS_PROFILING "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE" CACHE STRING "Flags for profiling") -set(CMAKE_C_FLAGS_DEBUG "-g -Og -ggdb -Wp,-U_FORTIFY_SOURCE" CACHE STRING "Flags for debugging") -set(CMAKE_C_FLAGS_RELEASE "-O2" CACHE STRING "Flags for releasing") -set(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage" CACHE STRING "Flags for coverage test") - -set(CMAKE_CXX_FLAGS_PROFILING "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE" CACHE STRING "Flags for profiling") -set(CMAKE_CXX_FLAGS_DEBUG "-g -Og -ggdb -Wp,-U_FORTIFY_SOURCE" CACHE STRING "Flags for debugging") -set(CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING "Flags for releasing") -set(CMAKE_CXX_FLAGS_CCOV "-g -O2 --coverage" CACHE STRING "Flags for coverage test") +# Compilation option depending on CMAKE_BUILD_TYPE +################################################## +add_compile_options($<$<OR:$<CONFIG:DEBUG>,$<CONFIG:PROFILING>,$<CONFIG:CCOV>>:-g>) + +add_compile_options($<$<CONFIG:DEBUG>:-pg>) +add_compile_options($<$<CONFIG:DEBUG>:-ggdb>) +add_compile_options($<$<CONFIG:CCOV>:--coverage>) + +add_compile_options($<$<CONFIG:DEBUG>:-Og>) +add_compile_options($<$<CONFIG:PROFILING>:-O0>) +add_compile_options($<$<OR:$<CONFIG:CCOV>,$<CONFIG:PROFILING>>:-O2>) + +add_compile_options($<$<OR:$<CONFIG:DEBUG>,$<CONFIG:PROFILING>>:-Wp,-U_FORTIFY_SOURCE>) + # Env variable overload default if(DEFINED ENV{INSTALL_PREFIX}) |