From 69c89af0cffe7f1d1f16d36798c4137158ea391d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Jun 2021 19:50:48 +0200 Subject: [PATCH 1/5] using more modern cmake syntax --- cmake/stm32/common.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index d8ef60bf..d3d12e40 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -42,11 +42,14 @@ find_program(CMAKE_SIZE NAMES ${STM32_TARGET_TRIPLET}-size PATHS ${TOOLCHAIN_BIN find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb PATHS ${TOOLCHAIN_BIN_PATH} NO_DEFAULT_PATH) find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt PATHS ${TOOLCHAIN_BIN_PATH} NO_DEFAULT_PATH) -FUNCTION(stm32_print_size_of_target TARGET) - # this target is always considered out of date so size will always be displayed on build - ADD_CUSTOM_TARGET(${TARGET}_size ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} - DEPENDS ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C}) -ENDFUNCTION() +function(stm32_print_size_of_target TARGET) + add_custom_command( + TARGET ${TARGET} + POST_BUILD + COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} + COMMENT "Target Sizes: " + ) +endfunction() function(stm32_get_chip_type FAMILY DEVICE TYPE) set(INDEX 0) From 4d2b5bb592d307f717836679319efff41cae7f21 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 23 Jun 2021 09:20:25 +0200 Subject: [PATCH 2/5] this always runs --- cmake/stm32/common.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index d3d12e40..bba2f448 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -43,11 +43,12 @@ find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb PATHS ${TOOLCHAIN_ find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt PATHS ${TOOLCHAIN_BIN_PATH} NO_DEFAULT_PATH) function(stm32_print_size_of_target TARGET) - add_custom_command( - TARGET ${TARGET} - POST_BUILD - COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} - COMMENT "Target Sizes: " + # this target is always considered out of date so size will always be displayed on build + add_custom_target( + ${TARGET}_size + ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} + DEPENDS ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} + COMMENT "Target sizes:" ) endfunction() From aa414446d8f554f5bda8ac2f001978a84454707e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 23 Jun 2021 10:00:50 +0200 Subject: [PATCH 3/5] this fixed the issue --- cmake/stm32/common.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index bba2f448..a3210f30 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -43,12 +43,10 @@ find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb PATHS ${TOOLCHAIN_ find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt PATHS ${TOOLCHAIN_BIN_PATH} NO_DEFAULT_PATH) function(stm32_print_size_of_target TARGET) - # this target is always considered out of date so size will always be displayed on build - add_custom_target( - ${TARGET}_size + add_custom_target(do_always ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} - DEPENDS ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} - COMMENT "Target sizes:" + COMMENT "Target Sizes: " + DEPENDS ${TARGET} ) endfunction() From 6212399ee7fb3df7299497fbf2bde41dc7b840b2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 23 Jun 2021 10:05:19 +0200 Subject: [PATCH 4/5] better custom target name --- cmake/stm32/common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index a3210f30..0963ae9a 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -43,7 +43,7 @@ find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb PATHS ${TOOLCHAIN_ find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt PATHS ${TOOLCHAIN_BIN_PATH} NO_DEFAULT_PATH) function(stm32_print_size_of_target TARGET) - add_custom_target(do_always + add_custom_target(always_display_size ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} COMMENT "Target Sizes: " DEPENDS ${TARGET} From fd370d8790ce6250bc3f7cdfb115de7699984af4 Mon Sep 17 00:00:00 2001 From: Spacefish <31589589+rmspacefish@users.noreply.github.com> Date: Wed, 23 Jun 2021 19:01:46 +0200 Subject: [PATCH 5/5] Update cmake/stm32/common.cmake Co-authored-by: Julien Staub --- cmake/stm32/common.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/stm32/common.cmake b/cmake/stm32/common.cmake index 0963ae9a..3ab48b3f 100644 --- a/cmake/stm32/common.cmake +++ b/cmake/stm32/common.cmake @@ -43,7 +43,7 @@ find_program(CMAKE_DEBUGGER NAMES ${STM32_TARGET_TRIPLET}-gdb PATHS ${TOOLCHAIN_ find_program(CMAKE_CPPFILT NAMES ${STM32_TARGET_TRIPLET}-c++filt PATHS ${TOOLCHAIN_BIN_PATH} NO_DEFAULT_PATH) function(stm32_print_size_of_target TARGET) - add_custom_target(always_display_size + add_custom_target(${TARGET}_always_display_size ALL COMMAND ${CMAKE_SIZE} ${TARGET}${CMAKE_EXECUTABLE_SUFFIX_C} COMMENT "Target Sizes: " DEPENDS ${TARGET} @@ -273,4 +273,3 @@ include(stm32/l1) include(stm32/l4) include(stm32/l5) -