aboutsummaryrefslogtreecommitdiffstats
path: root/reference
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-05 00:18:50 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-05 00:18:50 +0200
commit2d5f16ac2a87b8a9e525e55d9a93aee047e0b141 (patch)
tree52b9f5739d68e956e3677073649b16df3e57b081 /reference
parent2c661323fac0ba5a54d134a49632c31e7c4ffaa1 (diff)
Fix: make displaying closing message target as macro
GLOBAL_TARGETS_LIST is evaluated too early so its definition has been moved to PROJECT_TARGET_ADD which will update the variable for each new target defined. Change-Id: I8c001f71da0b7c55c763418517d1bd0fa9384498 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'reference')
-rw-r--r--reference/etc/macros.cmake33
1 files changed, 17 insertions, 16 deletions
diff --git a/reference/etc/macros.cmake b/reference/etc/macros.cmake
index 72f55f0..af5e542 100644
--- a/reference/etc/macros.cmake
+++ b/reference/etc/macros.cmake
@@ -30,6 +30,14 @@
macro(PROJECT_TARGET_ADD TARGET_NAME)
set(PROJECT_TARGETS ${PROJECT_TARGETS} ${TARGET_NAME} CACHE INTERNAL PROJECT_TARGETS)
set(TARGET_NAME ${TARGET_NAME})
+
+ # Cmake does not maintain targets list before 3.7
+ # -------------------------------------------------
+ if(${CMAKE_VERSION} VERSION_LESS 3.7)
+ set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS})
+ else()
+ get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList)
+ endif()
endmacro(PROJECT_TARGET_ADD)
macro(defstr name value)
@@ -221,24 +229,17 @@ endif()
if(EXTRA_DEPENDENCIES_ORDER)
set(DEPENDENCIES_TARGET ${PROJECT_NAME}_extra_dependencies)
add_custom_target(${DEPENDENCIES_TARGET} ALL
- DEPENDS ${EXTRA_DEPENDENCY_ORDER}
+ DEPENDS ${EXTRA_DEPENDENCY_ORDER}
)
endif()
-# Cmake does not maintain targets list before 3.7
-# -------------------------------------------------
-if(${CMAKE_VERSION} VERSION_LESS 3.7)
- set(GLOBAL_TARGET_LIST ${PROJECT_TARGETS})
-else()
- get_property(GLOBAL_TARGET_LIST GLOBAL PROPERTY GlobalTargetList)
-endif()
-
# Print developer helper message when everything is done
# -------------------------------------------------------
-if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST)
- add_custom_target(${PROJECT_NAME}_done ALL
- DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST}
- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
- )
-endif()
-
+macro(project_closing_msg)
+ if(CLOSING_MESSAGE AND GLOBAL_TARGET_LIST)
+ add_custom_target(${PROJECT_NAME}_done ALL
+ DEPENDS ${DEPENDENCIES_TARGET} ${GLOBAL_TARGET_LIST}
+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${CLOSING_MESSAGE}"
+ )
+ endif()
+endmacro()