Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6652173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:06:13+00:00 2026-05-26T01:06:13+00:00

How do I achieve the following in CMake (using version 2.8.5)? I have documentation

  • 0

How do I achieve the following in CMake (using version 2.8.5)? I have documentation generated by a custom target named doc, the output of which I would like to include when installing or CPack’ing.

add_custom_target( doc "${DOXYGEN_EXECUTABLE}" Doxyfile )
install( DIRECTORY ${CMAKE_BINARY_DIR}/doc DESTINATION doc )

The Doxyfile tells Doxygen to put out the documentation at ${CMAKE_BINARY_DIR}/doc.

If I do this in the build directory:

make doc
cpack

things works fine, because the first line creates the directory on which the install target depends.

However, if I have a fresh build (so ${CMAKE_BINARY_DIR}/doc does not exist yet), and I invoke CPack directly:

cpack

then it complains that it cannot find ${CMAKE_BINARY_DIR}/doc:

CMake Error at <snip>/build/cmake_install.cmake:36 (FILE):
  file INSTALL cannot find "<snip>/build/doc".

I have also tried the following:

add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/doc COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile )
install( DIRECTORY ${CMAKE_BINARY_DIR}/doc DESTINATION doc )

but I still get the same CPack error, and doing make doc in the build directory does not work either.

So if I do the make doc manually before cpack it works with the configuration at the top of this post, but how can I tell cmake/cpack that the install directive depends on the custom target doc, so that building the documentation happens automatically when calling cpack or make install?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:06:14+00:00Added an answer on May 26, 2026 at 1:06 am

    Probably you need ALL keyword:

    add_custom_target( doc ALL "${DOXYGEN_EXECUTABLE}" Doxyfile )
    

    Update:

    Currently cmake does not provide an option to add custom dependencies to its built-in targets (such as all, install, test, etc). And it seems that it will not provide this option in near future – see http://public.kitware.com/Bug/view.php?id=8438

    However it is still possible to achieve desired behavior with some hacks/workarounds. For example you can directly run make tool at the beginning of install step.

    So use on your own risk:

    add_custom_target(hack ${CMAKE_COMMAND} -E echo "Hacking install target")
    if("${CMAKE_GENERATOR}" MATCHES Make)
        install(CODE "execute_process(COMMAND ${CMAKE_BUILD_TOOL} hack WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")")
    endif()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a rich text box control using which i can achieve following functionality:
How can I achieve the following? I have two models (blogs and readers) and
How could I achieve the following: document.all.regTitle.innerHTML = 'Hello World'; Using jQuery where regTitle
I would like to achieve the following: I want a free Application Lifecycle Management
How to I achieve the following functionality? I have an array: a = [1,
I want to achieve the following xml using simple xml framework ( http://simple.sourceforge.net/ ):
im trying to achieve the following, in php i have a form like this:
How to achieve the following output in Java like windows Calculator, Example, First Row
Can I achieve the following with Magento: I'm using a table rate system of
How do I achieve the following slide left effect with JQuery? I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.