[CMake] Global dependency

Jonas Lippuner jonas at lippuner.ca
Wed Aug 27 03:58:48 EDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Petr,

Thanks! This works.


Best,
Jonas


- -------- Original Message  --------
Subject: Re: [CMake] Global dependency
From: Petr Kmoch <petr.kmoch at gmail.com>
To: Jonas Lippuner <jonas at lippuner.ca>
CC: "cmake at cmake.org" <cmake at cmake.org>
Date: Tue 26 Aug 2014 11:57:26 PM PDT

> Hi Jonas.
> 
> As a hacky solution, you could override add_library() and 
> add_executable(), like this:
> 
> function(add_library targetName) _add_library(${targetName}
> ${ARGN}) add_dependencies(${targetName} BuildInfoDateTime) 
> endfunction()
> 
> Petr
> 
> 
> 
> On Wed, Aug 27, 2014 at 5:44 AM, Jonas Lippuner <jonas at lippuner.ca 
> <mailto:jonas at lippuner.ca>> wrote:
> 
> Hi all,
> 
> I have a custom target called BuildInfoDateTime that generates a
> *.cpp file containing the date and time of the build. I specified
> the target with ALL, so it gets run if I simply type make. However,
> I would also like all other targets (executables and libraries) to
> depend on BuildInfoDateTime. Of course, I can add the dependency
> manually, but that is tedious and could be forgotten when new
> targets are added.
> 
> So, is there a way to make all targets depend on my custom target 
> BuildInfoDateTime?
> 
> 
> Thanks, Jonas
> 
> 
> --
> 
> 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://public.kitware.com/mailman/listinfo/cmake
> 
> 

- -- 
My email is signed and I encrypt email on request.
To verify my signature or send me encrypted email,
get my public key: http://lippuner.ca/key
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJT/Y+tAAoJELH92qHy0gntSgMQANZGcSpj9w44j52U2IQbkI/Q
P/s2IhHnfL/yrbNQwhQok5T37w5+lLx0/NJJGrSMZoCVLG1FVoj+ARCfovQSnkWB
OMrRqHAh57kcrti/7HMfLbhTTvPYfc3t6Rw0HPfzQecFNlApHU0N+uinZpe6FBrK
gqH3dugK1AwLyk19Htif6JL4uRfrOh2Gp709L4hOMLd3C264sOVIrlct2xVBy1Uv
P9oAGznh2pgYITrUUL66XT7n8BBW9zGsjcYbxnHbo4ikRWZ3gl/+2cQP+0/i0y+C
9Ku/w7jJI5wC5jG+rOORJFwiVQShXBd13WPBuwKbz5MXv4fdr91dwnaNrug9iMRB
o1Ql2wR2lU7cDBUV/D7GvSwbHTrTswwG5rvr5Bdv7HrqdyGJuYZ9dYkcqBx8wqz+
ijAmGMDMazTCoESU1uR7gQOTo5GwwK9TYPdV/93wg3P+lY3tJAEjB9RU1TG94//p
QDNJ58mgoAATKQKJzpcgokEuhAJAOqjgSv62Eh+M0YavV8nODsH9mswmMvqNLzt0
sklvY3qD7Bmhu1AhEPOQG5+zwXAAOVjW9GXfh7hqZNr8d+pNyZ+nfidIlOLVpy3G
JEPK4ZvnJ/0DomTPyLq9aXh4es9BVY7Tvcz0P5A80YV/JdUvFwMZONQOdMamo9Xp
+XwdvGa0oERaAhH2vPp4
=EwpZ
-----END PGP SIGNATURE-----


More information about the CMake mailing list