CMakeFile No such file error when building project through command line in Ubuntu

When building a project on Ubuntu through the terminal I get a CMakeFile no such file or directory error. The file/s not being found are header files for a C program. This occurs even when the CMakeList.txt file explicitly points to the a headerfile that when building says it cannot find. It gets to about halfway through the build and compile process and the environment is configured correctly (by following the nordic guide setup for linux). The exact same project builds and compiles perfectly on windows (through command line) however, when I try on Ubuntu it cannot find the headerfiles and produces an error such as:

'fatal error: filename.h: No such file or directory' (where filename would be the name of the header file) and then points to the line in the c program where it includes the header file: "4 | #include "filename.h"".

I was wondering if there is an issue with compatibility of the project (specifically the CMakeFile.txt compatibility) between windows and ubuntu as it works on windows but not ubuntu?

Parents
  • Hi,

    This is hard to answer without seeing some actual examples of how the headers are included, and the exact build output. Can you provide a minimal example showing this issue?

    Since it works on Window but not on Ubuntu/Linux, could it be as simple as having backwards slashes (\) in the paths instead of forward slashes (/)?

    Best regards,
    Jørgen

  • Hi,

    The error is to do with zephyr_include_directories() in the CMakeFiles.txt file as to build the project successfully I need to be able to make it PUBLIC and not INTERFACE. Is there a way to specify zephyr_include_directories() to use PUBLIC instead of the default INTERFACE like you can with target_include_directories()? If I try specify PUBLIC with zephyr_include_directories() I get the error: "Cannot specify include directories for target "PUBLIC" which is not built
      by this project.".

    Thank you

Reply
  • Hi,

    The error is to do with zephyr_include_directories() in the CMakeFiles.txt file as to build the project successfully I need to be able to make it PUBLIC and not INTERFACE. Is there a way to specify zephyr_include_directories() to use PUBLIC instead of the default INTERFACE like you can with target_include_directories()? If I try specify PUBLIC with zephyr_include_directories() I get the error: "Cannot specify include directories for target "PUBLIC" which is not built
      by this project.".

    Thank you

Children
No Data
Related