summaryrefslogtreecommitdiffstats
path: root/cmake/cmake.d
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-08-08 11:51:05 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-15 18:22:47 +0200
commit355b28c7783ae846043cae86a166931f09b8924e (patch)
tree4cec036d138705a99499872c24b452de4f7ed49a /cmake/cmake.d
parentb5bc6ff322112503b038f564ee44ccfce8f1fd05 (diff)
Format and Make CMake dependencies cleaner.
Use CMake recommended way to specifies target dependencies. As well add dependencies on needed files or directories in custom_command. Change-Id: I617e54a4c312336ea1cf306409456fbc55be7fa5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/cmake.d')
-rw-r--r--cmake/cmake.d/02-macros.cmake26
1 files changed, 16 insertions, 10 deletions
diff --git a/cmake/cmake.d/02-macros.cmake b/cmake/cmake.d/02-macros.cmake
index 8cb0e45..3713d80 100644
--- a/cmake/cmake.d/02-macros.cmake
+++ b/cmake/cmake.d/02-macros.cmake
@@ -83,37 +83,43 @@ macro(project_targets_populate)
if(${T} STREQUAL "BINDING")
list(APPEND BINDINGS_LIST "${P}${OUT}")
add_custom_command(OUTPUT ${PACKAGE_LIBDIR}/${P}${OUT}.so
+ DEPENDS ${BD}/${P}${OUT}.so
COMMAND mkdir -p ${PACKAGE_LIBDIR}
COMMAND cp ${BD}/${P}${OUT}.so ${PACKAGE_LIBDIR}
- DEPENDS ${BD}/${P}${OUT}.so
)
message ("DEPENDS ${BD}/${P}${OUT}.so")
- add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${TARGET} DEPENDS ${PACKAGE_LIBDIR}/${P}${OUT}.so)
- add_dependencies(populate ${POPULE_PACKAGE_TARGET} ${TARGET})
+ add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_LIBDIR}/${P}${OUT}.so)
+ add_dependencies(populate ${POPULE_PACKAGE_TARGET})
+ add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
elseif(${T} STREQUAL "EXECUTABLE")
add_custom_command(OUTPUT ${PACKAGE_BINDIR}/${P}${OUT}
+ DEPENDS ${BD}/${P}${OUT}
COMMAND mkdir -p ${PACKAGE_BINDIR}
COMMAND cp ${BD}/${P}${OUT} ${PACKAGE_BINDIR}
- DEPENDS ${BD}/${P}${OUT}
)
- add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${TARGET} DEPENDS ${PACKAGE_BINDIR}/${P}${OUT})
- add_dependencies(populate ${POPULE_PACKAGE_TARGET} ${TARGET})
+ add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_BINDIR}/${P}${OUT})
+ add_dependencies(populate ${POPULE_PACKAGE_TARGET})
+ add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
elseif(${T} STREQUAL "HTDOCS")
add_custom_command(OUTPUT ${PACKAGE_HTTPDIR}-xx
+ DEPENDS ${BD}/${P}${OUT}
COMMAND mkdir -p ${PACKAGE_HTTPDIR}
COMMAND touch ${PACKAGE_HTTPDIR}
COMMAND cp -r ${BD}/${P}${OUT}/* ${PACKAGE_HTTPDIR}
)
- add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_HTTPDIR}-xx)
- add_dependencies(populate ${POPULE_PACKAGE_TARGET} ${TARGET})
+ add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_HTTPDIR}-xx)
+ add_dependencies(populate ${POPULE_PACKAGE_TARGET})
+ add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
elseif(${T} STREQUAL "DATA")
add_custom_command(OUTPUT ${PACKAGE_DATADIR}-xx
+ DEPENDS ${BD}/${P}${OUT}
COMMAND mkdir -p ${PACKAGE_DATADIR}
COMMAND touch ${PACKAGE_DATADIR}
COMMAND cp -r ${BD}/${P}${OUT}/* ${PACKAGE_DATADIR}
)
- add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_DATADIR}-xx)
- add_dependencies(populate ${POPULE_PACKAGE_TARGET} ${TARGET})
+ add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_DATADIR}-xx)
+ add_dependencies(populate ${POPULE_PACKAGE_TARGET})
+ add_dependencies(${POPULE_PACKAGE_TARGET} ${TARGET})
endif(${T} STREQUAL "BINDING")
elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
MESSAGE(".. Warning: ${TARGET} ignored when packaging.")