[CMake] Dependencies

Phil Smith phil at voltage.com
Wed Feb 5 12:33:40 EST 2014


Thanks, Petr. This sounds like what we need, but I must be missing something.

I have:
SET( ZFPE_FILES
    FOO.asm
)
(and of course many more files in that variable). Then later:
add_library(zfpe ${ZFPE_FILES})
set_property(SOURCE FOO.asm PROPERTY OBJECT_DEPENDS BAR.mac)

(all files have explicit paths on them). When I do a cmake, it builds the world. Then I change BAR.mac and do a cmake and a make and it doesn't reassemble FOO.

This is all complicated somewhat by the additional plumbing I have wrapped around it (we're cross-compiling with a two-phase compiler, and so there's some other stuff in there), but the cmake and make are both definitely being invoked.

One (of many) things I'm not understanding is where the check for changes to BAR takes place. I notice that BAR does not appear in the MakeFile at all.

I tried adding a few MESSAGEs and it's doing the set_property as expected (i.e., that code didn't somehow get bypassed).

From: Petr Kmoch [mailto:petr.kmoch at gmail.com]
Sent: Wednesday, February 05, 2014 3:08 AM
To: Phil Smith
Cc: cmake at cmake.org
Subject: Re: [CMake] Dependencies

Hi Phil.

If your FOO.asm is used as a source file (i.e. it's listed in an add_executable() or add_library() command), then you can use the source file property OBJECT_DEPENDS for that:
  add_executable(myexe FOO.asm other.file one.more)
  set_property(SOURCE FOO.asm PROPERTY OBJECT_DEPENDS BAR.mac BAZ.mac) #any list of dependencies here
As an alternative to set_property(), you can use the weaker, but shorthand setter set_source_files_properties() (which can set it for multiple files at once).

If they're somehow processed with a custom command/target (i.e. via add_custom_command() or add_custom_target() instead of library/executable), you can use that command's DEPENDS argument.
Petr

On Tue, Feb 4, 2014 at 7:57 PM, Phil Smith <phil at voltage.com<mailto:phil at voltage.com>> wrote:
This is surely something basic, but I'm far from a CMake guru and would rather not spend weeks digging to solve something that *seems* like it'll be simple.

We have assembler modules in a project. These use macros, as assembler modules are wont to do.

So if module FOO.asm uses macro BAR.mac, and we change BAR, a CMake should rebuild FOO. We recognize that we're going to have to define these dependencies manually, but I'm assuming/hoping that there's a way to do that in a CMakeLists.

Unfortunately words like "dependency" make lousy search terms!

Can someone point me? Or, even better, give me an example of how to say "FOO.asm depends on macro BAR.mac"?

Thanks...
--
...phsiii

Phil Smith III

--

Powered by www.kitware.com<http://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://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140205/1e7db43e/attachment-0001.html>


More information about the CMake mailing list