[CMake] Custom target not triggered to build

Robert Maynard robert.maynard at kitware.com
Tue Apr 7 14:05:16 EDT 2015


Add custom command doesn't generate a target. You need to use
add_custom_target to create an actual target.

I believe what you are missing is a custom target that consume the output
of the add custom command, than the install should work. A fully contained
example that I could run would make solving this issue easier.

On Tue, Apr 7, 2015 at 12:48 PM, J Decker <d3ck0r at gmail.com> wrote:

> Am I incorrect in assuming that this should work?
>
> I added dependancies to them and that helped... until I leared I had the
> dependants wrong order, and it wouldn't let me depend the common on both of
> these... so when I reversed them, then neither built before install....
>
> I recall a similar message not long ago about asking to depend targets on
> INSTALL... but I can't use install because it's a phony target.
>
> On Mon, Apr 6, 2015 at 5:26 PM, J Decker <d3ck0r at gmail.com> wrote:
>
>> I have a script that builds some package sort of files based on other
>> sources...
>>
>> Basically a simplified version...
>> I would think since the output file of add_custom_command was referenced
>> in a INSTALL that those targets should get build before INSTALL... but
>> using MinGW Makefiles, 'make install' fails to generate either file....
>>
>> ------ CMakeLists.txt -------------
>> cmake_minimum_required(VERSION 3.0)
>>
>> project( test )
>>
>> add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/resources.kw
>> COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/resources.kw
>>                    )
>> INSTALL( FILES ${CMAKE_BINARY_DIR}/resources.kw DESTINATION bin )
>>
>>
>> add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/application.dat
>>    COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/application.dat
>>                    )
>> INSTALL( FILES ${CMAKE_BINARY_DIR}/application.dat DESTINATION bin )
>> ------------ end CMakeLists.txt --------------
>>
>>
>>
>>
>>
>>
>>
>
> --
>
> Powered by 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150407/ad07570c/attachment.html>


More information about the CMake mailing list