[CMake] Dependencies

Phil Smith phil at voltage.com
Tue Feb 11 08:32:44 EST 2014


I owe you a beer! Thank you. Many, many hours saved here. And of course yeah, I feel dumb for not having grokked in fullness.

/me starts the day on a high note

From: Petr Kmoch [mailto:petr.kmoch at gmail.com]
Sent: Tuesday, February 11, 2014 1:57 AM
To: Phil Smith
Cc: cmake at cmake.org
Subject: Re: [CMake] Dependencies

Quoting the documentation of OBJECT_DEPENDS:

  Specifies a semicolon-separated list of full-paths to files on which any object files compiled from this source file depend.
Notice the "full-paths" bit. You're not providing a full path. You must make the path absolute; you can probably prefix it with an appropriate selection from ${CMAKE_SOURCE_DIR}, ${CMAKE_CURRENT_SOURCE_DIR}, ${CMAKE_BINARY_DIR}, ${CMAKE_CURRENT_BINARY_DIR}, ${CMAKE_CURRENT_LIST_DIR} or similar variables.

Petr

On Tue, Feb 11, 2014 at 1:12 AM, Phil Smith <phil at voltage.com<mailto:phil at voltage.com>> wrote:
Can I bother you to look at my CMakeLists.txt and see if you see why the
set_property(SOURCE VSHVOLT.asm APPEND PROPERTY OBJECT_DEPENDS src/zprotect/asm/VSHVOLTX.mac)

on line 385 doesn't seem to be "taking"?

What I do is a CMake, then I edit VSHVOLTX.mac and save it, and another CMake. Nothing gets built. VSHVOLT.asm should get reassembled.

This is driving me crazy...

From: Petr Kmoch [mailto:petr.kmoch at gmail.com<mailto:petr.kmoch at gmail.com>]
Sent: Wednesday, February 05, 2014 12:08 AM

To: Phil Smith
Cc: cmake at cmake.org<mailto: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/20140211/a2c1ba18/attachment-0001.html>


More information about the CMake mailing list