From b6c2727fb266f7a2b02fe56f929490e9a78a6768 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 5 May 2017 00:24:19 +0200 Subject: Generate a new target only if LABELS has been set. Change-Id: I0a7fc0a141c738da1211a1b51198e78cc0e5f286 Signed-off-by: Romain Forlot --- reference/etc/macros.cmake | 74 +++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'reference/etc') 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) -- cgit 1.2.3-korg