diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-05 00:18:50 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-15 18:22:20 +0200 |
commit | f2037221a69d496f13fc9d143ec85de54f596960 (patch) | |
tree | 5d515680510b1046d344e348a3ed3390d7b0ae8c | |
parent | ff98b3c6e456694562509874b1cb55dade2ace2a (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>
-rw-r--r-- | reference/etc/macros.cmake | 33 |
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() |