diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-05 00:24:19 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-15 18:22:20 +0200 |
commit | b6c2727fb266f7a2b02fe56f929490e9a78a6768 (patch) | |
tree | 96b8f18dca20fd5035fd177d49427bcafd2b3c1a /reference/etc/macros.cmake | |
parent | 9084ff8ba4e06a3a76710599b369b98e8a217e9f (diff) |
Generate a new target only if LABELS has been set.
Change-Id: I0a7fc0a141c738da1211a1b51198e78cc0e5f286
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'reference/etc/macros.cmake')
-rw-r--r-- | reference/etc/macros.cmake | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/reference/etc/macros.cmake b/reference/etc/macros.cmake index 5a85b86..184f8ba 100644 --- a/reference/etc/macros.cmake +++ b/reference/etc/macros.cmake @@ -47,32 +47,15 @@ endmacro(defstr) # WGT packaging macro(project_targets_populate) foreach(TARGET ${PROJECT_TARGETS}) - # Declaration of a custom command that will populate widget tree with the target - set(POPULE_WIDGET_TARGET "project_populate_${TARGET}") - get_target_property(T ${TARGET} LABELS) - get_target_property(P ${TARGET} PREFIX) - get_target_property(BD ${TARGET} BINARY_DIR) - get_target_property(OUT ${TARGET} OUTPUT_NAME) - - if(${T} STREQUAL "BINDING") - add_custom_command(OUTPUT ${WIDGET_LIBDIR}/${P}${TARGET}.so - DEPENDS ${TARGET} - COMMAND mkdir -p ${WIDGET_LIBDIR} - COMMAND cp ${BD}/${P}${OUT}.so ${WIDGET_LIBDIR} - ) - add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_LIBDIR}/${P}${TARGET}.so) - elseif(${T} STREQUAL "EXECUTABLE") - add_custom_command(OUTPUT ${WIDGET_BINDIR}/${P}${TARGET} - DEPENDS ${TARGET} - COMMAND mkdir -p ${WIDGET_BINDIR} - COMMAND cp ${BD}/${P}${OUT} ${WIDGET_BINDIR} - ) - add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_BINDIR}/${P}${TARGET}) - elseif(${T} STREQUAL "HTDOCS") - add_custom_command(OUTPUT ${WIDGET_HTTPDIR} - DEPENDS ${TARGET} - COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_HTTPDIR} + if(T) + # Declaration of a custom command that will populate widget tree with the target + set(POPULE_WIDGET_TARGET "project_populate_${TARGET}") + + get_target_property(P ${TARGET} PREFIX) + get_target_property(BD ${TARGET} BINARY_DIR) + get_target_property(OUT ${TARGET} OUTPUT_NAME) + if(P MATCHES "NOTFOUND$") if (${T} STREQUAL "BINDING") set(P "lib") @@ -81,20 +64,37 @@ macro(project_targets_populate) endif() endif() + if(${T} STREQUAL "BINDING") + add_custom_command(OUTPUT ${WIDGET_LIBDIR}/${P}${TARGET}.so + DEPENDS ${TARGET} + COMMAND mkdir -p ${WIDGET_LIBDIR} + COMMAND cp ${BD}/${P}${OUT}.so ${WIDGET_LIBDIR} ) - add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR}) - elseif(${T} STREQUAL "DATA") - add_custom_command(OUTPUT ${WIDGET_DATADIR} - DEPENDS ${TARGET} - COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_DATADIR} + add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_LIBDIR}/${P}${TARGET}.so) + elseif(${T} STREQUAL "EXECUTABLE") + add_custom_command(OUTPUT ${WIDGET_BINDIR}/${P}${TARGET} + DEPENDS ${TARGET} + COMMAND mkdir -p ${WIDGET_BINDIR} + COMMAND cp ${BD}/${P}${OUT} ${WIDGET_BINDIR} ) - add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR}) - else() - if(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]") - MESSAGE(AUTHOR_WARNING "This target, ${TARGET}, will be not be included in the package.") - endif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]") - endif(${T} STREQUAL "BINDING") - PROJECT_TARGET_ADD(${POPULE_WIDGET_TARGET}) + add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_BINDIR}/${P}${TARGET}) + elseif(${T} STREQUAL "HTDOCS") + add_custom_command(OUTPUT ${WIDGET_HTTPDIR} + DEPENDS ${TARGET} + COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_HTTPDIR} + ) + add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR}) + elseif(${T} STREQUAL "DATA") + add_custom_command(OUTPUT ${WIDGET_DATADIR} + DEPENDS ${TARGET} + COMMAND cp -r ${BD}/${P}${OUT} ${WIDGET_DATADIR} + ) + add_custom_target(${POPULE_WIDGET_TARGET} ALL DEPENDS ${WIDGET_HTTPDIR}) + endif(${T} STREQUAL "BINDING") + PROJECT_TARGET_ADD(${POPULE_WIDGET_TARGET}) +# elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]") +# MESSAGE(AUTHOR_WARNING "This target, ${TARGET}, will be not be included in the package.") + endif() endforeach() endmacro(project_targets_populate) |