<div dir="ltr"><div>I have a function  that does something like this:</div><div><br></div><div>add_dependencies(${LibraryName} SomeTarget)<br>add_custom_command(TARGET SomeTarget PRE_BUILD<br>  COMMAND MyExecutable.exe<br>  USES_TERMINAL<br>  )</div><div><br></div><div>It creates the dependency without any issues, but it gives the following error on the custom command:</div><div><br></div><div>CMake Error at CMakeLists.txt:37 (add_custom_command):<br>  The target name "SomeTarget" is unknown in this context.</div><div><br></div><div>SomeTarget is created using add_library later in the build system.</div><div><br></div><div>Is there some way to make this work?  SomeTarget is created deeper in the build system (3-5 directories down).</div></div>