From e8dd7eeb10111024c4dcfc61fd4f371c1dd92fe7 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 8 Aug 2017 11:51:05 +0200 Subject: 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 --- cmake/cmake.d/02-macros.cmake | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'cmake') 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.") -- cgit 1.2.3-korg