[CMake] add_custom_commmand TARGET is unknown

Daniel Dilts diltsman at gmail.com
Wed Apr 15 19:25:29 EDT 2015


I have a function  that does something like this:

add_dependencies(${LibraryName} SomeTarget)
add_custom_command(TARGET SomeTarget PRE_BUILD
  COMMAND MyExecutable.exe
  USES_TERMINAL
  )

It creates the dependency without any issues, but it gives the following
error on the custom command:

CMake Error at CMakeLists.txt:37 (add_custom_command):
  The target name "SomeTarget" is unknown in this context.

SomeTarget is created using add_library later in the build system.

Is there some way to make this work?  SomeTarget is created deeper in the
build system (3-5 directories down).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150415/b61cb66b/attachment.html>


More information about the CMake mailing list