Doxygen does not recognize absolute path on windows with mingw

Viewed 233

Hi I am trying to generate my docs with cmake + doxygen. As stated in the cmake documentation for FindDoxygen the output path:

[...] will be converted to an absolute path relative to the current binary directory

Now in my build/Doxyfile.doxygen I have the option with the absolute windows path:

OUTPUT_DIRECTORY = D:/projects/MyProject/build/

But calling doxygen with this Doxyfile will produce:

error: Could not create output directory /d/projects/MyProject/D:/projects/MyProject/build/html

I am asuming this is because I'm using mingw and doxygen does not recognize the windows path as absolute and therefore tries to attach the cwd in front of it.

The relevant commands in my CMakeLists.txt look like this:

find_package(Doxygen
        REQUIRED dot
        OPTIONAL_COMPONENTS mscgen dia)

if (DOXYGEN_FOUND)
    doxygen_add_docs(Doxygen)
endif()

Does anyone know how to fix this?

Edit:

  • CMake Version: 3.20.2
  • doxygen Version: 1.9.1 (ec8203f43232e7e7b16b1c85351c7c48d128f924)

Edit2: I'm using clion to run CMake using the bundeled version. Running cmake .. && make Doxyfile from commandline works

1 Answers

The issue you have could be related to how you specify the path.

Windows style path will look like this:

OUTPUT_DIRECTORY = D:\projects\MyProject\build

while MSYS style path will look like this:

OUTPUT_DIRECTORY = /d/projects/MyProject/build

But specifying an absolute path is not a very good idea, especially if you want to distribute the source or move/copy it somewhere else. It's best to just specify a folder relative to the location from where you will run doxygen, which in your case probably looks like this:

OUTPUT_DIRECTORY = build
Related