create_nordic_project.py failed(1) when trying to add existing file in CMakeLists.txt

Hi,

I am trying add existing file in CMakeLists.txt a main.cpp file inside Project libapp.a, at which i am getting this python error.
Kindly help.

Regards,

Parents
  • Hello, 

    Can you please elaborate more on what you are trying to achieve? What version of the nRF Connect SDK are you using? What project are you trying to add this file to? Have you read the output error that is provided in the output of SES?

    -Øyvind

  • How did you edit the CmakeLists.txt? Please fix CmakeLists.txt to the following

    Hello ,

    I just added main.cpp

    target_sources(app PRIVATE
    	src/main.c
    	src/model_handler.c
    	src/main.cpp)



    Just wanted to understand why it is happening.!
    Seems manually changing the CMakeLIsts.txt to default is the only way to work around this issue.

  • My apologies for missing some of your comments, and providing some confusing answers. 

    Ubaid_M said:
    right click on project libapp.a and select "Add existing file to CmakeLists.txt" and select the main.cpp file

    I missed this information earlier. I tested the same on my side and got the same result. 

    Ubaid_M said:
    Seems manually changing the CMakeLIsts.txt to default is the only way to work around this issue.

    Yes, at the moment it seems that this is the only solution. Either by "Open CmakeLists.txt in Editor" or, in your case, via Notepad++. 

    I did find an answer to why this is happening from our developers (which means it's known):

    SES-NE only supports regular CMake functions inside those tags, and not a Zephyr extension command like: target_sources_ifdef().

    Such functions are written back incorrectly and having their lines wrapped incorrectly, causing the `(` to appear on an independent line, which results in an invalid CMake file.

    This has been fixed in this sample by moving the offending function outside the tags, as can be seen here:
    https://github.com/nrfconnect/sdk-nrf/pull/5130

Reply
  • My apologies for missing some of your comments, and providing some confusing answers. 

    Ubaid_M said:
    right click on project libapp.a and select "Add existing file to CmakeLists.txt" and select the main.cpp file

    I missed this information earlier. I tested the same on my side and got the same result. 

    Ubaid_M said:
    Seems manually changing the CMakeLIsts.txt to default is the only way to work around this issue.

    Yes, at the moment it seems that this is the only solution. Either by "Open CmakeLists.txt in Editor" or, in your case, via Notepad++. 

    I did find an answer to why this is happening from our developers (which means it's known):

    SES-NE only supports regular CMake functions inside those tags, and not a Zephyr extension command like: target_sources_ifdef().

    Such functions are written back incorrectly and having their lines wrapped incorrectly, causing the `(` to appear on an independent line, which results in an invalid CMake file.

    This has been fixed in this sample by moving the offending function outside the tags, as can be seen here:
    https://github.com/nrfconnect/sdk-nrf/pull/5130

Children
No Data
Related