summaryrefslogtreecommitdiffstats
path: root/reference/etc/macros.cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-05 00:24:19 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-05 00:24:19 +0200
commita04180ccc6885bf2048af4e538051a1ed3d236f9 (patch)
tree2fdff05daa6525a6a471af89e73352b1fd1eb775 /reference/etc/macros.cmake
parentce3f41af229012f093f5301294f828b52fdbed70 (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.cmake74
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)