Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake Error (configure_file): configure_file error configuring file

Tags:

cmake

doxygen

I am working on a project on c++ and need to execute a CMakeLists.txt file to run it. I installed cmake, doxygen, cmake-curses-gui and make using sudo. Then I tried running the file.

The following is a part of the cmake code -

if (BUILD_DOC)
   find_package(Doxygen)
   configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
   ${PROJECT_SOURCE_DIR}/doc/Doxyfile @ONLY)
   add_custom_target(${PROJECT_NAME}_doc ALL ${DOXYGEN_EXECUTABLE}
   ${PROJECT_SOURCE_DIR}/doc/Doxyfile)
endif ()

Here, it gave me an error message saying that

CMake Error at CMakeLists.txt:77 (configure_file): configure_file Problem configuring file

Just so that you know, line 77 is configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in .

If I add AND DOXYGEN_FOUND to the if condition, it doesn't execute anything at all which means that it couldn't find a doxygen executable. But as I already told, I already installed doxygen.

I am new to cmake. So, could anyone please help me with this

Edit:

The OS I am using is Ubuntu 16.04

After I put if(DOXYGEN_FOUND) after the command find_package(doxygen) it executed, but I got the same cmake error in line 78 instead of line 77

Also, now since I got enough information from the comments, I just realized that my problem is more towards finding where the Doxyfile.in file lies than configuring the file. Could anyonee help me with it?

like image 711
S_rockz Avatar asked Dec 26 '17 06:12

S_rockz


1 Answers

The error is clear

configure_file Problem configuring file

CMake's configure_file(<input> <output>) command is used to copy input file to ouput and replacing @VARIABLES@ in input by the corresponding value.

configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_SOURCE_DIR}/doc/Doxyfile @ONLY)

You have to find why this process failed:

  1. Make sure ${PROJECT_SOURCE_DIR} contains the correct path to your project, and make sure the file Doxyfile.in is is the right folder (<project dir>/doc)
  2. Make sure content of Doxyfile.in does not contains any syntax error, in particular with @VARIABLES@ that needs to be replaced by their CMake value.

Note that this error has nothing to do with Doxygen on your system, and the fact that CMake actually found it or not.

like image 62
Antwane Avatar answered Nov 15 '22 09:11

Antwane