View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010217CMakeCMakepublic2010-02-01 11:152016-06-10 14:31
ReporterShlomi Fish 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010217: make exits with "make[3]: *** No rule to make target `USAGE_pdf', needed by `CMakeFiles/pdfs'. Stop." when looping targets
Description---------

shlomi[fcs]:$fcs/branches/cmake-make-pdfs-breakage-investigation/source/t/CMake-2.6-2.8-and-CVS-breakage-PDF-loop$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/shlomi/progs/freecell/branches/cmake-make-pdfs-breakage-investigation/source/t/CMake-2.6-2.8-and-CVS-breakage-PDF-loop
shlomi[fcs]:$fcs/branches/cmake-make-pdfs-breakage-investigation/source/t/CMake-2.6-2.8-and-CVS-breakage-PDF-loop$ make pdfs
Scanning dependencies of target AUTHORS_pdf
[ 0%] docmake to PDF
[ 50%] Built target AUTHORS_pdf
Scanning dependencies of target USAGE_pdf
[ 50%] docmake to PDF
[100%] Built target USAGE_pdf
Scanning dependencies of target pdfs
make[3]: *** No rule to make target `USAGE_pdf', needed by `CMakeFiles/pdfs'. Stop.
make[2]: *** [CMakeFiles/pdfs.dir/all] Error 2
make[1]: *** [CMakeFiles/pdfs.dir/rule] Error 2
make: *** [pdfs] Error 2
shlomi[fcs]:$fcs/branches/cmake-make-pdfs-breakage-investigation/source/t/CMake-2.6-2.8-and-CVS-breakage-PDF-loop$

------

This distribution that generates this bug (after running "cmake ." and "make pdfs") has been upload to this report.
Additional InformationMy CMakeLists.txt is very simple and looks like:

-------------------------

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET (_docfiles "AUTHORS.xml" "USAGE.xml" )

SET (_pdf_targets)

FOREACH(_file ${_docfiles})
    GET_FILENAME_COMPONENT(_file_wo_ext ${_file} NAME_WE)

    SET (_pdf "${_file_wo_ext}.pdf")

    SET (_target "${_file_wo_ext}_pdf")

    ADD_CUSTOM_COMMAND(
        OUTPUT "${_pdf}"
        COMMAND cp -f ${_file} ${_pdf}
        DEPENDS ${_file}
        COMMENT "docmake to PDF"
    )

    ADD_CUSTOM_TARGET("${_target}" echo -n
        DEPENDS "${_pdf}"
    )

    LIST(APPEND _pdf_targets "${_target}")

ENDFOREACH(_file)

ADD_CUSTOM_TARGET("pdfs" echo -n
    DEPENDS ${_pdf_targets}
)

-------------------------

I add targets in a loop and then the master "pdfs" target fails. You can also find it at svn here:

https://svn.berlios.de/svnroot/repos/fc-solve/branches/cmake-make-pdfs-breakage-investigation [^]
TagsNo tags attached.
Attached Filesgz file icon CMake-2.6-2.8-and-CVS-breakage-PDF-loop.tar.gz [^] (12,162 bytes) 2010-02-01 11:15

 Relationships

  Notes
(0019399)
Bill Hoffman (manager)
2010-02-01 11:29

Have you tried full paths?

Something like this:

 ADD_CUSTOM_COMMAND(
        OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_pdf}"
        COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" "${CMAKE_CURRENT_BINARY_DIR}/${_pdf}"
        DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_file}"
        COMMENT "docmake to PDF"
    )
(0019402)
Shlomi Fish (reporter)
2010-02-01 11:32

I should note that it happened with CMake-2.6.x, and is happening with CMake-2.8.x and CMake-CVS.

Regards,

-- Shlomi Fish
(0019405)
Shlomi Fish (reporter)
2010-02-01 11:51

Now, I did add the full paths. As expected - the same result. You can find it here:

https://svn.berlios.de/svnroot/repos/fc-solve/branches/cmake-make-pdfs-breakage-investigation [^]
(0019408)
Bill Hoffman (manager)
2010-02-01 12:38

OK, I see the problem.


ADD_CUSTOM_TARGET("pdfs" echo -n
    DEPENDS ${_pdf_targets}
)

This is a file based depend, not a target level depend. See the docs:http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_target [^]

You want to use: ADD_DEPENDENCIES for targets.
(0019410)
Shlomi Fish (reporter)
2010-02-01 13:09

@bill.hoffman : thanks! That seems to fix the problem both in the cmake-make-pdfs branch and in the master fc-solve branch at:

https://svn.berlios.de/svnroot/repos/fc-solve/trunk/fc-solve/source [^]

However, this issue is not closed yet, because now we need to make sure that as few people as possible will get stumbled by it and will report it in the future (or get frustrated). As Joel on Software mentions here, you should solve any problem twice:

http://www.joelonsoftware.com/articles/customerservice.html [^]

So I suggest adding a visible warning about that to the documentation, or possibly adding some logic to the command to give a more instructive error.
(0019411)
Bill Hoffman (manager)
2010-02-01 13:58

So, this has come up before.... :)

That is why the documentation mentions it here:
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:add_custom_target [^]

There is not a good way to catch it with a warning at code time. Did you read the docs before running into this problem? Do you have alternate wording that would be stronger?
(0019426)
Shlomi Fish (reporter)
2010-02-02 05:04

@bill.hoffman: I would add a

<<<

Note: [possibly with colour] the dependencies specified DEPENDS must be output files, not other implicit targets. In order to specify targets, use ADD_DEPENDENCIES.

>>>

I should note that the documentation can use more hyperlinks (like linking ADD_DEPENDENCIES to its position.).
(0041650)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2010-02-01 11:15 Shlomi Fish New Issue
2010-02-01 11:15 Shlomi Fish File Added: CMake-2.6-2.8-and-CVS-breakage-PDF-loop.tar.gz
2010-02-01 11:29 Bill Hoffman Note Added: 0019399
2010-02-01 11:29 Bill Hoffman Status new => assigned
2010-02-01 11:29 Bill Hoffman Assigned To => Bill Hoffman
2010-02-01 11:32 Shlomi Fish Note Added: 0019402
2010-02-01 11:51 Shlomi Fish Note Added: 0019405
2010-02-01 12:38 Bill Hoffman Note Added: 0019408
2010-02-01 13:09 Shlomi Fish Note Added: 0019410
2010-02-01 13:58 Bill Hoffman Note Added: 0019411
2010-02-02 05:04 Shlomi Fish Note Added: 0019426
2016-06-10 14:27 Kitware Robot Note Added: 0041650
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team