I've got the following problem using cmake. I use UseDoxygen from http://tobias.rautenkranz.ch/cmake/doxygen/ to generate the documentation for my library. This works fine, but know I want to realize the following: When I call "make install" I want to build to Documentation and install it too. Therefore I add
install(DIRECTORY ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR} DESTINATION share/doc/mylib/)
add_dependencies(install doc)
to my CMakeLists.txt. This results in an error:
CMake Error at CMakeModules/UseDoxygen.cmake:145 (add_dependencies):
add_dependencies Adding dependency to non-existent target: install
Call Stack (most recent call first):
CMakeLists.txt:141 (include)
Is it possible to get a easy workaround for this? Because if the targets are not connected the install step installs nothing unless "make doc" is done manually befor calling "make install".
regards Grisu
This command has been superseded by the install () command. It is provided for compatibility with older CMake code. Create rules to install the listed targets into the given directory. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX.
We build our documentation by adding it with add_custom_target with the ALL option specified so it builds with the all target. Then to install, it's just the install command. There is no need to add anything to the install target. If you add the documentation to the all target, then doing make install will also build the documentation.
GetPrerequisites.cmake. get_prerequisites is a lower level function that allow you to get the dependencies. The thing is, I don't any good way/best practice to use it.
Because if the targets are not connected the install step installs nothing unless "make doc" is done manually befor calling "make install". See the answer to this question. We build our documentation by adding it with add_custom_target with the ALL option specified so it builds with the all target.
We build our documentation by adding it with add_custom_target
with the ALL
option specified so it builds with the all
target.
Then to install, it's just the install
command. There is no need to add anything to the install
target.
If you add the documentation to the all
target, then doing make install
will also build the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With