Knowledge Base Article
Why does CMake Error: The source directory "<project_directory>/intel_niosv_m_0_EXAMPLE_DESIGN" does not contain CMakeLists.txt. when compiling the Nios® V processor application in Command Line Interface?
Description
This problem is observed in Quartus® Prime Pro Edition Software version 21.3 when the command “cmake -G “Unix Makefile” -B software/app/build” is executed to compile the Nios® V processor application for the design example.
This is due to missing “-S <path-to-source>“ argument. Without the argument, the cmake command defaults to the current working directory (<project_directory>/intel_niosv_m_0_EXAMPLE_DESIGN) as the source directory.
For reader’s information about this design example, the design example is provided with a readme.txt. The readme.txt guides user to create CMakeLists.txt for the design example.
- The BSP CMakeLists.txt is generated by niosv-bsp command, found in <project_directory>/intel_niosv_m_0_EXAMPLE_DESIGN/software/bsp.
- The APP CMakeLists.txt is generated by niosv-app command, found in <project_directory>/intel_niosv_m_0_EXAMPLE_DESIGN/software/app.
- There is no CMakeLists.txt in <project_directory>/intel_niosv_m_0_EXAMPLE_DESIGN.
However, the snippet of the cmake command in the readme.txt is missing “-S <path-to-source>“ argument. Thus, this error is produced.
Resolution
To fix this problem, follow one of the following steps:
Execute this command:
cmake -G "Unix Makefiles" -S software/app/ -B software/app/build
The “-S software/app/“ argument adds the CMakeLists.txt path to the source location.
OR
Change the directory to software/app folder: “cd software/app”. Then, execute the command:
make -G "Unix Makefiles" -B build
This problem is fixed starting with the Quartus® Prime Pro Edition Software version 21.4. The readme.txt is corrected with “cmake -G "Unix Makefiles" -S software/app/ -B software/app/build“