0

I am not that much sound in CMake and which leads to me in this issue. I am trying to use Doxygen in a project using CMake. Previously, I have used Doxygen version 1.8.11 which was installed from Ubuntu package manager. I have simply followed the following command to install Doxygen

sudo apt-get install doxygen

And in the project in CMakeLists.txt file I have included

find_package(Doxygen REQUIRED)

Everything works flawlessly.

But now for a specific reason I have to upgrade my Doxygen version which is not available in Ubuntu package manager, that's why I have built the binary by following this. The downloaded Doxygen Source directory and my project directory are not the same.

  • My query is how can I tell CMake to search for this newly installed/build Doxygen?
  • Still, I am finding the version of Doxygen is 1.8.11
  • I am using Ubuntu 16.04, cmake version 3.19.0-rc3
user10634362
  • 549
  • 5
  • 21
  • I don't see the direct relation between CMake and Sphinx. I assume you want to build doxygen on your ubuntu 16.04 system. When you downloaded the sources you could used the procedure `mkdir build; cd build; cmake -G "Unix Makefiles" ..; make;` to build doxygen and `make install` to install it (Note I didn't test the install patrt). Alternatively to the `make install` you could prepend the directory `.../build/bin` to your path or see to it that the doxygen executable is in a directory that is in the path before the directory where your 1.8.11 version is. – albert Dec 27 '21 at 18:45
  • A question that arises is which version of GCC is installed, as when to old the build might fail. – albert Dec 27 '21 at 18:45
  • I have already installed/build `Doxygen` from source successfully that one you have written. And I think the usage of `Sphinx` is redundant here. I am removing those part/words. And I am not searching any relation between `Sphinx` and `CMake` here. My query is to know the process to tell `CMake` use/find `Doxygen` which I have built from source. – user10634362 Dec 27 '21 at 18:55
  • Most likely you will need to use `find_package(doxygen)` when the new doxygen can be found early enough in the path or use in the call to CMake something like `cmake -DDOXYGEN_EXECUTABLE=.../bin/doxygen.exe`. – albert Dec 27 '21 at 19:08
  • Your suggestion has worked. By the way, I guess a small typo (`dot sign ( .. )` is missing after `cmake` command) is there (tested in Linux). Command : `cmake .. -DDOXYGEN_EXECUTABLE=../../doxygen-1.9.2/build/bin/doxygen`. Is there any way to make this new version of `doxygen` as the main/ default version? – user10634362 Dec 27 '21 at 21:26
  • Indeed I didn't specify the dots (or other options that could be used). To make it the default version either see to it that the directory where the new doxygen version resides is earlier in the path that the directory of the current doxygen executable or replace the current doxygen executable with the new executable. – albert Dec 28 '21 at 08:42
  • @albert in my present system version of `Doxygen` is `1.9.3` (seen by using `doxygen --version`) and also I have seen in `/usr/bin/doxygen` is that the version is `1.9.3`. But still `cmake ..` cannot get the Doxygen version 1.9.3, it is still getting version `1.8.17` (installed by apt-get). Any idea why this is happening? – user10634362 Jan 06 '22 at 16:27
  • When you have the 1.9.3 version by means of apt-get it should place it at the right place (probably /usr/bin). Where is your 1.9.3 version placed and where is the 1.8.17 version? Is the path of the 1.8.17 version before the path of the 1.9.3 version? When you have the 1.9.3 version installed yourself and it is not properly in the path you have to use the `-DDOXYGEN_EXECUTABLE` way or place it properly in the path (I have a doxygen, wrapper script, that is in /usr/local/bin and calls the right version). – albert Jan 06 '22 at 16:36
  • @albert Right now in any place of my system I have not found the `1.8.17` version but somehow CMake get it. By the way, I have not installed the `Doxygen 1.9.3 binary` by myself as I am not the root user but after asking the admin I have come to know that the older version is replaced by the new one. Is there any location from where still `CMake` fetches the older version of the Doxygen? In my `/usr/bin`, `/usr/local/bin` Doxygen version is `1.9.3`. – user10634362 Jan 07 '22 at 07:09
  • When all is well you should have in your file CMakeCache.txt on your build directory a line starting with DOXYGEN_EXECUTABLE this will give you an indication of where the found doxygen version is. You can also look in your FindDoxygen.cmake of your cmake installation where cmake has looked for the doxygen executable. – albert Jan 07 '22 at 09:43
  • @albert `CMakeCache.txt` indicates the path by `DOXYGEN_EXECUTABLE` is `/usr/bin/doxygen`. And after going in this path in the terminal I have written `doxygen` and it shows that the version is `1.9.3`. But the CMake is telling it has found `1.8.17`. And where I will find this file `FindDoxygen.cmake`? – user10634362 Jan 07 '22 at 11:12
  • The FindDoxygen.cmake should be in the modules directory of your cmake installation. Strange that cmake tells you it found doxygen 1.8.17 but you have 1.9.3. Can you write from your CMakeLists.txt the DOXYGEN_VERSION like after the FindDoxygen command something like: ` message(WARNING "Doxygen version found: ${DOXYGEN_VERSION}") – albert Jan 07 '22 at 11:24
  • @albert Added the line as you have said. It is `1.8.17`. Is there any way to add the path direct in CMakeLists.txt file to find the path f doxygen? Right now I am using `cmake .. -DDOXYGEN_EXECUTABLE=/net/software/doxygen/doxygen-1.9.3/bin/doxygen` where it finds the version `1.9.3`. I want to add this extra flag direct in CMakeLists.txt file. By the way, you can see that here extra flag is pointed to `/net/software/doxygen/` directory. I have checked here and as well as `/usr/bin/doxygen` and found all time version is `1.9.3`. Only CMake cannot fetch this version. – user10634362 Jan 07 '22 at 12:20
  • In a previous comment it says "... is /usr/bin/doxygen. And after going in this path in the terminal I have written doxygen and it shows that the version is 1.9.3...." and what happens when you do the same but not `doxygen -v` but `./doxygen -v` (might make a difference)? As you wrote that you used: `-DDOXYGEN_EXECUTABLE=/net/software/doxygen/doxygen-1.9.3/bin/doxygen` what happens when you use `-DDOXYGEN_EXECUTABLE="/net/software/doxygen/doxygen-1.9.3/bin/doxygen"` or `-DDOXYGEN_EXECUTABLE=/net/software/doxygen/doxygen\-1.9.3/bin/doxygen` (maybe even 2 backslashes) I'm not font of minus-signs – albert Jan 07 '22 at 13:05
  • @albert In `/usr/bin` I have opened terminal and tested `./doxygen -v` and it is `1.8.17`. But in any other location as well as here `doxygen -v` is `1.9.3`. That means the replacement of `/usr/bin/doxygen` by `/net/software/doxygen/doxygen-1.9.3/bin/doxygen` is done perfectly or I am something else ? And other commands what you have written tried too and it finds as usual version `1.9.3`. Moreover, I have not found this file `FindDoxygen.cmake`. Only get `/usr/bin/cmake` – user10634362 Jan 07 '22 at 14:07
  • Took me some time to find the information. When you give `cmake --find-package` you will get an error message but it will also tell you where you probably can find the `modules` directory. When I recall correctly some older versions of the find tool just have a limited search path and are by default not able to find it outside of the own specified search path (which version of cmake are you using?). – albert Jan 07 '22 at 15:09
  • `cmake version 3.16.3` and also find the file. Is there any way to set the path of the Doxygen in this command `find_package(Doxygen REQUIRED)`? I am trying to follow [this](https://stackoverflow.com/a/49816516/10634362) but failed. Used command `find_package(Doxygen REQUIRED PATHS /net/software/doxygen/doxygen-1.9.3/bin/doxygen)` – user10634362 Jan 07 '22 at 15:41
  • I hardly use doxygen inside other projects and when than the `-DDOXYGEN_ECECUTABLE` works for me. The find_package syntax looks OK to me. As I wrote before I'm a bit allergic to minus signs `-` and also to dos (`.`) in the path names, maybe you should rename the directory `doxygen-1.9.3` to `doxygen_1_9_3`. – albert Jan 07 '22 at 15:48

0 Answers0