diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-08-08 11:51:05 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-08-08 11:51:05 +0200 |
commit | e8dd7eeb10111024c4dcfc61fd4f371c1dd92fe7 (patch) | |
tree | 9cf48f84b79162b7a6e132fe5a389a04472075d4 /cmake/cmake.d | |
parent | 5a789de6ce66db056397efa8343d31b9e84628ef (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.cmake | 26 |
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.") |