aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-06 17:47:09 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-07-06 17:47:09 +0200
commit6be72c1389f3aba83d42b46ffef223a51eb8b495 (patch)
tree254ba7498e9b20ab1f5d182a64100263ae15cf87 /cmake
parente401ff722737d95e2ab8d0f0b142d06537e90678 (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')
-rw-r--r--cmake/cmake.d/04-build_options.cmake23
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})