[CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target

Nils Gladitz nilsgladitz at gmail.com
Tue Aug 4 17:07:28 EDT 2015


On 04.08.2015 22:46, Dan Liew wrote:
>
>    The target name "foolib" is unknown in this context.
> This warning is for project developers.  Use -Wno-dev to suppress it
> ```
>
>
> This doesn't make sense the target **clearly exists and is in scope**
> because the ``simple_test`` executable links against it and also it is
> possible to read properties of the target.
>
> Seems like there's some sort of weird scope issue going on here.
>
>

foolib is defined in this CMakeLists.txt:
https://github.com/delcypher/cmake_add_custom_command_bug/blob/master/lib/CMakeLists.txt

That is the (only) context in which you can extend the definition of the 
target with custom commands.

Nils


More information about the CMake mailing list