Hi there, I only started using CMake a couple days ago so please pardon the newbie questions. I'm having some trouble understanding the relationships between add_dependencies, add_custom_command, and add_custom_target as they relate to forming dependencies on external project targets.
I am trying to write plugins for a CMake-enabled project. How one goes about this is by getting the source and adding an optional cmake module that calls what amounts to a custom externalproject_add() with no build/install step; the external sources are just copied into the framework's source tree. That way, when I call `make`, the framework build includes the plugins. (This inflexible "linking" mechanism is necessary due to language constraints that aren't relevant here) The way I've integrated this into my own project is via my own externalproject_add() that grabs the framework and, as a custom step, copies over the module I mentioned: ExternalProject_Add(framework # ... ) ExternalProject_Add_Step(framework copy-plugin-loader # First symlink so the framework will "download" from local fs COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}" "${framework_EXTERNALS_DIR}/my-plugins" # Now link the custom module it needs to find in its modules dir COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_BINARY_DIR}/CMake/plugin_loader.cmake" "${heka_SOURCE_DIR}/cmake/plugin_loader.cmake" DEPENDERS configure DEPENDEES download ) Later on in my CMakeLists I use add_test() and use `ctest` to run my plugin tests (that only work once my source is grafted onto the framework's tree; see weird language design choice mentioned above). My question (finally) is this: how can I tell CMake that, if I change a source or test file in *my* tree, the framework (specifically, a custom target defined in _the framework's_ CMakeLists) needs to be rebuilt before the tests can run? To illustrate, here's my current workflow: # Edit *my* source files, tests, whatever, then... % cd framework/binary_dir % make graft_plugin_sources % cd - % ctest . Ideally, I could just run `ctest` and CMake will handle the rest. I don't know if that's a thing it does, so, I'd settle for calling the top-level `make` again. I just can't figure out the proper add_*() calls to make to tell CMake "My project (and/or custom target/command of my own) depends on this particular target of `framework` so whenever I change a source file in my project, we gotta re-run it." Thanks in advance for any insight, Tom -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake