diff options
author | Le Go <leonid.a.gorbachev@gmail.com> | 2023-04-27 13:00:37 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-04-27 16:54:00 -0400 |
commit | 5ee19d5746aa1be0179042287a2e37929eff01f0 (patch) | |
tree | 0ca41de518ecbfe3a6941a58753e96f0fe5fcf62 | |
parent | 582c17bdd24b8443f82b3da4143893741d6b1c1f (diff) | |
download | cmake-5ee19d5746aa1be0179042287a2e37929eff01f0.tar.gz |
FindDoxygen: Optionally use custom config file
-rw-r--r-- | Help/release/dev/FindDoxygen-custom-config-file.rst | 5 | ||||
-rw-r--r-- | Modules/FindDoxygen.cmake | 20 |
2 files changed, 21 insertions, 4 deletions
diff --git a/Help/release/dev/FindDoxygen-custom-config-file.rst b/Help/release/dev/FindDoxygen-custom-config-file.rst new file mode 100644 index 0000000000..badc26e35b --- /dev/null +++ b/Help/release/dev/FindDoxygen-custom-config-file.rst @@ -0,0 +1,5 @@ +FindDoxygen-custom-config-file +------------------------------ + +* The :module:`FindDoxygen` module's ``doxygen_add_docs`` command gained + a ``CONFIG_FILE`` option to specify a custom doxygen configuration file. diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index ef9801eb24..76f47590c3 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -76,7 +76,8 @@ Functions [ALL] [USE_STAMP_FILE] [WORKING_DIRECTORY dir] - [COMMENT comment]) + [COMMENT comment] + [CONFIG_FILE filename]) The function constructs a ``Doxyfile`` and defines a custom target that runs Doxygen on that generated file. The listed files and directories are used as @@ -97,6 +98,10 @@ Functions the :command:`add_custom_target` command used to create the custom target internally. + .. versionadded:: 3.27 + If ``CONFIG_FILE`` is set, the given file provided with full-path + will be used as doxygen configuration file + .. versionadded:: 3.12 If ``ALL`` is set, the target will be added to the default build target. @@ -864,7 +869,7 @@ endfunction() function(doxygen_add_docs targetName) set(_options ALL USE_STAMP_FILE) - set(_one_value_args WORKING_DIRECTORY COMMENT) + set(_one_value_args WORKING_DIRECTORY COMMENT CONFIG_FILE) set(_multi_value_args) cmake_parse_arguments(_args "${_options}" @@ -1166,8 +1171,15 @@ doxygen_add_docs() for target ${targetName}") # Prepare doxygen configuration file set(_doxyfile_template "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in") - set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}") - configure_file("${_doxyfile_template}" "${_target_doxyfile}") + if(_args_CONFIG_FILE) + if(NOT EXISTS "${_args_CONFIG_FILE}") + message(FATAL_ERROR "Option CONFIG_FILE specifies file:\n ${_args_CONFIG_FILE}\nbut it does not exist.") + endif() + set(_target_doxyfile "${_args_CONFIG_FILE}") + else() + set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}") + configure_file("${_doxyfile_template}" "${_target_doxyfile}") + endif() unset(_all) if(${_args_ALL}) |