Hi there,

Depends on what you mean by "tools". If you mean running some sort of
static analysis over your code, there's a few ways to do it. I prefer
to use add_custom_command which generates a new makefile based on some
output stampfile. You can make the stampfile depend on the input file
that you're analysing and add the stampfile as a source-level
dependency to your built library or binary. This way, the tool will be
re-run every time you modify the file.

For instance:

    add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_NAME}.stamp
                                            COMMAND my-tool ${SOURCE_NAME}
                                            COMMAND ${CMAKE_COMMAND}
-E touch ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_NAME}.stamp
                                            DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_NAME}
                                            COMMENT "Running my-tool
on ${SOURCE_NAME}")

[self-promotion]: I was doing this for quite a few tools, so I wrote a
module to quickly define functions that allow you to run various tools
over source files:
https://github.com/polysquare/tooling-cmake-util/blob/master/PolysquareToolingUtil.cmake

It has some dependencies which you can either install using conan or
just add them as git submodules and set CMAKE_MODULE_PATH
appropriately.

You can contact me on this email address if you need any help.

Thanks,

Sam.

On Fri, Aug 12, 2016 at 3:17 PM, Costean Adrian via cmake-developers
<cmake-developers@cmake.org> wrote:
> Hello,
> I am currently developing some projects which involves a build system and 
> some tools. I would like to know what are the possibilities when it comes to 
> integrate other tools in the cmake build system? How can that be done and 
> what are the obstacles for achieving that?
> Thanks and regards,
> Adrian C.
> --
>
> 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-developers



-- 
Sam Spilsbury
-- 

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-developers

Reply via email to