Hi all, When using a custom command in a macro I see some strange behavior.
The following setup is used: I have a macro, called "bundle", in this macro a custom command is added. This command uses a library as target, and executes cpack with a configuration. I use cpack to create a zip file inside my project with the library and additional resources. This macro is used with the name of a library. When running the library target (make {lib-name}), the command is executed for all usages of the macro, instead of only for the given target. If I change it to a custom target, and add that target to the library target using add_dependencies it is all ok, but a custom target is always out-of-date, which is something I would like to prevent. If I run the cpack command myself it is only executed once (as expected). What am I doing wrong here? TiA! ps: The macro I use: ------------------------ macro(bundle) PARSE_ARGUMENTS(BUNDLE "FILES;DIRECTORIES" "" ${ARGN}) LIST(GET BUNDLE_DEFAULT_ARGS 0 BUNDLE_NAME) SET(__bundleConfig ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${BUNDLE_NAME}-bundle.cmake) CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/CPackConfig.in ${__bundleConfig} @ONLY) ADD_CUSTOM_COMMAND(TARGET ${BUNDLE_NAME} POST_BUILD WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bundles # This is an echo of the command. Running this myself on the command line works as expected COMMAND echo ${BUNDLE_NAME} ${CPACK_COMMAND} --config "${__bundleConfig}" # This is executed for each macro call I did COMMAND ${CPACK_COMMAND} --config "${__bundleConfig}" ) endmacro(bundle) ------------------------ -- Met vriendelijke groet, Alexander Broekhuis
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake