Forum Discussion

paulgeisler's avatar
paulgeisler
Icon for New Contributor rankNew Contributor
1 hour ago

Build error on tutorial, missing CMakeLists.txt

I previously built the tutorial helloworld project with no errors.

I then made small changes to the BSP generation settings and re-generated the BSP.

I did not try to re-import the BSP code into my project because it was already imported.

I immediately re-built the whole project in RiskFree, I get the following error:

CMake Error: The source directory "C:/fpga_projects/an985/helloworld" does not appear to contain CMakeLists.txt.

I verified that there is no CMakeLists.txt file in the folder C:/fpga_projects/an985/helloworld. This is because that folder contains a subfolder Software which has subfolders for hal_app and hal_bsp, each of which contains their own CMakeLists.txt file.

Where would I change a file or a configuration so that the build knows there there are two subprojects, each with their own CMakeLists.txt file? See attached screenshot of folders and files.

 

1 Reply

  • ai_responder's avatar
    ai_responder
    Icon for Community Manager rankCommunity Manager

    The error message tells you exactly what's wrong: RiscFree's CMake build configuration for one (or both) of your projects is pointing at the top-level helloworld folder rather than at the individual hal_app or hal_bsp subdirectories where the CMakeLists.txt files actually live.
    In RiscFree IDE, the correct way to set up Nios V projects is to import them individually: click File > Import Nios V CMake Project, then browse and select the location of the Nios V processor BSP project directory — and repeat the same step for the application project directory. Importing Nios® V Processor Project Each import must point directly to the folder that contains its own CMakeLists.txt (i.e., Software/hal_bsp and Software/hal_app), not the parent helloworld folder.
    After you specify the correct location path, the CMake-driven application or BSP project is added to the Project Explorer, and the project name is automatically filled in. Importing Nios® V Processor Project
    So here's what I'd do to fix your situation:

    1. In the Project Explorer, remove the incorrectly configured project(s) that are pointing at the top-level helloworld directory.
    2. Click File > Import Nios V CMake Project and browse to C:/fpga_projects/an985/helloworld/Software/hal_bsp. Click Finish.
    3. Repeat the import for C:/fpga_projects/an985/helloworld/Software/hal_app.
    4. After importing both projects, establish the dependency between them: right-click the application project in Project Explorer, select Properties, navigate to the Project References tab, and check the option box for the BSP project. Importing Nios® V Processor Project
    One additional note on BSP regeneration: do not edit BSP files directly. Use the BSP Editor or Nios V processor utilities instead — if you edit directly, you lose your edits as BSP files are overwritten and regenerated by the BSP Editor. Nios V Processor Software Developer Handbook After regenerating, the CMakeLists.txt in hal_bsp will have been recreated automatically, so re-importing from the correct path should resolve the build error immediately.


    Note: To continue using AI Responder, please start your next inquiry with ai_responder

    Disclaimer (Beta): The AI Responder is currently provided as a beta feature. AI-generated responses may contain errors or omissions. Please verify technical guidance with official Altera documentation before implementation.

    Thank you very much.