On 11/10/2011 12:25 AM, EXT-York, Gantry wrote:
> And the command "specialtest" is executed out of the build tree?
>
> This is what I'm doing now....
>
> CMakeLists.txt
> add_custom_target(aggr_target)
> add_subdirectory(a)
> add_subdirectory(b)
>
> a/CMakeLists.txt
> add_executable( specialtest1 IMPORTED )
> add_custom_target(a_special_test COMMAND specialtest1)
> add_dependencies(aggr_target a_special_test)
>
> b/CMakeLists.txt
> add_executable( specialtest2 IMPORTED )
> add_custom_target(b_special_test COMMAND specialtest2)
> add_dependencies(aggr_target b_special_test)
>
>
> It can't seem to find specialtest1 or specialtest2 to execute.
That's because specialtest{1,2} don't denote anything which could be
run; set their IMPORTED_LOCATION properties to an executable, or use
FIND_PROGRAM(SPECIALTEST specialtest) and "COMMAND ${SPECIALTEST}"
in the ADD_CUSTOM_TARGET() commands.
Regards,
Michael
> Gantry York
> Chandler, Arizona
>
>
>
> -----Original Message-----
> From: Łukasz Tasz [mailto:[email protected]]
> Sent: Wednesday, November 09, 2011 3:52 PM
> To: EXT-York, Gantry
> Cc: [email protected]
> Subject: Re: [CMake] Custom targets that traverse subdirectories
>
> Hi
>
> As far as I understood your problem correctly:
>
> in main cmakelists create target that will agregate subtargets:
> main_cmake:
>
> add_custom_target(aggr_target)
> add_subdirectory(a)
> add_subdirectory(b)
>
> a/CMakeLists.txt
> add_custom_target(a_special_test COMMAND specialtest)
> add_dependencies(aggr_target a_special_test)
>
> b/CMakeLists.txt
> add_custom_target(b_special_test COMMAND specialtest)
> add_dependencies(aggr_target b_special_test)
>
>
> after generation when you will call:
> make aggr_target
>
> both special tests for a and b dir will be executed.
>
> br
> L.
>
> 2011/11/9 EXT-York, Gantry <[email protected]>:
>> How do I define a custom target and have it traverse the source tree?
>>
>>
>>
>> I'm using
>>
>>
>>
>> add_custom_target(
>>
>> specialtest
>>
>> COMMAND rel/path/to/test_script
>>
>> )
>>
>>
>>
>> However, I need to add other commands to this target that come from scripts
>> in subdirectories.
>>
>>
>>
>>
>>
>>
>>
>> Gantry York
>>
>> Chandler, Arizona
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake