Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to tell CMake that install directory depends on phony target?
    primarykey
    data
    text
    <p>How do I achieve the following in CMake (using version 2.8.5)? I have documentation generated by a custom target named <code>doc</code>, the output of which I would like to include when installing or CPack'ing.</p> <pre><code>add_custom_target( doc "${DOXYGEN_EXECUTABLE}" Doxyfile ) install( DIRECTORY ${CMAKE_BINARY_DIR}/doc DESTINATION doc ) </code></pre> <p>The <code>Doxyfile</code> tells Doxygen to put out the documentation at <code>${CMAKE_BINARY_DIR}/doc</code>.</p> <p>If I do this in the build directory:</p> <pre><code>make doc cpack </code></pre> <p>things works fine, because the first line creates the directory on which the <code>install</code> target depends.</p> <p>However, if I have a fresh build (so <code>${CMAKE_BINARY_DIR}/doc</code> does not exist yet), and I invoke CPack directly:</p> <pre><code>cpack </code></pre> <p>then it complains that it cannot find <code>${CMAKE_BINARY_DIR}/doc</code>:</p> <pre><code>CMake Error at &lt;snip&gt;/build/cmake_install.cmake:36 (FILE): file INSTALL cannot find "&lt;snip&gt;/build/doc". </code></pre> <p>I have also tried the following:</p> <pre><code>add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/doc COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile ) install( DIRECTORY ${CMAKE_BINARY_DIR}/doc DESTINATION doc ) </code></pre> <p>but I still get the same CPack error, and doing <code>make doc</code> in the build directory does not work either.</p> <p>So if I do the <code>make doc</code> manually before <code>cpack</code> it works with the configuration at the top of this post, but how can I tell cmake/cpack that the <code>install</code> directive depends on the custom target <code>doc</code>, so that building the documentation happens automatically when calling <code>cpack</code> or <code>make install</code>?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload