[CMake] add_custom_command scope
Hendrik Sattler
post at hendrik-sattler.de
Tue Jan 19 07:15:13 EST 2016
Am 19. Januar 2016 12:30:39 MEZ, schrieb Lars <laasunde at hotmail.com>:
> Hello,
>
>Using CMake 3.3 and VS2012.
>
>The below cmake scripts generate "Policy CMP0040 is not set: The target
>in the TARGET signature of add_custom_command must exists". Why cannot
>the custom/CMakeLists.txt file see the target created in
>app/CMakeLists.txt ? Moving the ADD_CUSTOM_COMMAND to the
>app/CMakeLists.txt fixes the problem but I would like to keep them
>separate if possible.
>
>PROJECT(TEST)
>ADD_DIRECTORY(app)
>ADD_DIRECTORY(custom)
>
>The app CMakeLists.txt looks like this;
>ADD_EXECUTABLE(app main.cpp)
>TARGET_LINK_LIBRARIES(app)
>
>The custom CMakeLists.txt looks like this;
>ADD_CUSTOM_COMMAND(
> TARGET app
> POST_BUILD
> COMMAND tbd.exe)
>
>Appreciate any input.
Make that its own custom target and let it depend on app target.
>Kind regards, Lars
>
>
>------------------------------------------------------------------------
More information about the CMake
mailing list