[CMake] failing target

Michael Hertling mhertling at online.de
Tue Mar 6 09:01:00 EST 2012


On 03/06/2012 02:47 PM, Andrea Crotti wrote:
> On 03/06/2012 01:45 PM, Michael Hertling wrote:
>>
>> Could you post the lines which define those targets psi.utility_install
>> and install_all_eggs, or is this quite tricky, too? Do these lines stem
>> from the same CMakeLists.txt? IIRC, the "no rule to make... needed by"
>> error occurs when there's something wrong with the DEPENDS clause of
>> ADD_CUSTOM_COMMAND/TARGET().
>>
>> Regards,
>>
>> Michael
> 
> Well I think it's something related to the platform, because both on my 
> Linux
> box and windows it works perfectly.
> 
> This is the interesting part anyway:
> 
> foreach(egg ${egg_list})
>    #TODO: now I need to replace the name with only the last part of the path
>    get_filename_component(egg_name ${egg} NAME)
>    set(egg_install ${egg_name}_install)
>    # generate the list of targets to create more easily dependencies
>    list(APPEND egg_install_list ${egg_install})
> 
>    add_custom_target(${egg_install}
>      COMMAND ${PYTHON_EXECUTABLE} setup.py -q bdist_egg -d 
> ${EGG_BUILD_DIRECTORY}
>      WORKING_DIRECTORY ${egg}
>    )
> 
> endforeach()
> 
> add_custom_target(install_all_eggs
>    DEPENDS ${egg_install_list}
> )
> 
> #TODO: add this target to the dependencies of run and packing if it works
> add_custom_target(unzip_all_eggs
>    # unzip the eggs and clean up the zips
>    COMMAND ${PYTHON_EXECUTABLE} ${UNZIP_SCRIPT} ${EGG_BUILD_DIRECTORY} 
> ${EGG_UNZIPPED_DIRECTORY}
>    # copy the two run files in the final destination
>    COMMAND ${CMAKE_COMMAND} -E copy ${EGG_BUILD_DIRECTORY}/${RUNNER} 
> ${EGG_UNZIPPED_DIRECTORY}/${RUNNER}
>    COMMAND ${CMAKE_COMMAND} -E copy ${EGG_BUILD_DIRECTORY}/${C_RUNNER} 
> ${EGG_UNZIPPED_DIRECTORY}/${C_RUNNER}
> 
>    DEPENDS install_all_eggs
> )
> 
> 
> sdo the targets are generated at cmake-time reading from a file and then 
> there are few more targets that depend on
> all of them.
> 
> Is there anything wrong in this part?

Yes, the DEPENDS clause of ADD_CUSTOM_TARGET() is only for *file*
dependencies, but you use it for *target* dependencies. According
to the documentation of ADD_CUSTOM_TARGET():

"Dependencies listed with the DEPENDS argument may reference files
and outputs of custom commands created with add_custom_command()
in the same directory (CMakeLists.txt file)."

"Use ADD_DEPENDENCIES to add dependencies to or from other targets."

Regards,

Michael


More information about the CMake mailing list