# Raspberry board export and CMakeLists.txt

**URL:** <http://forum.squareline.io/t/raspberry-board-export-and-cmakelists-txt/3358>\
**Category:** Bugs\
**Tags:** release\
**Created:** [June 13, 2024, 3:12am UTC](http://forum.squareline.io/t/raspberry-board-export-and-cmakelists-txt/3358 "2024-06-13T03:12:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickoppen](http://forum.squareline.io/letter_avatar_proxy/v4/letter/n/58f4c7/32.png) [@nickoppen](http://forum.squareline.io/u/nickoppen)\
**Post date:** [June 13, 2024, 3:12am UTC](http://forum.squareline.io/t/raspberry-board-export-and-cmakelists-txt/3358/1 "2024-06-13T03:12:02Z")

</div>

### What do you want to achieve?

I want to export my SLS files to a pi5 and compile them using c++.

### What have you tried so far?

I followed the procedure outlined in [https://github.com/SquareLineStudio/board\_raspberry\_pi/tree/v1.0.0](https://github.com/SquareLineStudio/board_raspberry_pi/tree/v1.0.0) and found that the c++ files were not able to be linked.

After a lot of scratching I modified the CMakeLists.txt file thus:

> cmake\_minimum\_required(VERSION 3.15)  
> set(CMAKE\_SYSTEM\_NAME Generic)
> 
> if (WIN32)  
> set(CMAKE\_GENERATOR “MinGW Makefiles”)  
> endif (WIN32)
> 
> #set(CMAKE\_BUILD\_TYPE Release)
> 
> set(CMAKE\_C\_STANDARD 11)  
> set(CMAKE\_CXX\_STANDARD 17)
> 
> #cross-compilation toolchain configuration  
> set(CMAKE\_CROSSCOMPILING true)  
> set(CMAKE\_SYSTEM\_PROCESSOR aarch64)  
> set(CMAKE\_LIBRARY\_ARCHITECTURE **aarch64-linux-gnu** )  
> set(CMAKE\_C\_COMPILER ${CMAKE\_LIBRARY\_ARCHITECTURE}-gcc)  
> set(CMAKE\_CXX\_COMPILER ${CMAKE\_LIBRARY\_ARCHITECTURE}-g++)  
> set(CMAKE\_LINKER ${CMAKE\_LIBRARY\_ARCHITECTURE}-ld)
> 
> project(SquareLine\_Project C **CXX** )
> 
> set(SDL\_FOLDER sdl2-dev-rpi64)  
> set(CMAKE\_FIND\_ROOT\_PATH ${SDL\_FOLDER})  
> set(CMAKE\_FIND\_ROOT\_PATH\_MODE\_PROGRAM NEVER)  
> set(CMAKE\_FIND\_ROOT\_PATH\_MODE\_LIBRARY ONLY)  
> set(CMAKE\_FIND\_ROOT\_PATH\_MODE\_INCLUDE ONLY)
> 
> set(CMAKE\_BUILD\_RPATH “${SDL\_FOLDER}/include”)  
> set(CMAKE\_INSTALL\_RPATH ${CMAKE\_BUILD\_RPATH})
> 
> include\_directories(  
> ${PROJECT\_SOURCE\_DIR}  
> ${PROJECT\_SOURCE\_DIR}/${SDL\_FOLDER}/include  
> ${PROJECT\_SOURCE\_DIR}/lvgl  
> # ${PROJECT\_SOURCE\_DIR}/lv\_drivers  
> ${PROJECT\_SOURCE\_DIR}/ui  
> )
> 
> FILE(GLOB\_RECURSE LVGL\_Sources CONFIGURE\_DEPENDS ${SDL\_FOLDER})  
> FILE(GLOB\_RECURSE LVGL\_Sources CONFIGURE\_DEPENDS lvgl/_.c)  
> #FILE(GLOB\_RECURSE LV\_DRIVERS\_Sources CONFIGURE\_DEPENDS lv\_drivers/_.c)  
> FILE(GLOB\_RECURSE UI\_Sources CONFIGURE\_DEPENDS ui/_.c ui/_.cpp)
> 
> add\_executable(${PROJECT\_NAME} **main.cpp** ${LVGL\_Sources} ${LV\_DRIVERS\_Sources} ${UI\_Sources})
> 
> target\_link\_libraries(${PROJECT\_NAME} -L"${PROJECT\_SOURCE\_DIR}/${SDL\_FOLDER}/lib" SDL2 )

In Summary: CXX needed to be in the project arguement; the -none needs to be removed from set(CMAKE\_LIBRARY\_ARCHITECTURE aarch64-none-linux-gnu) and main.cpp replaces main.c in add\_executable and in the project folder.

It works now.

### Screenshot or video

### Others

- **SquareLine Studio version: 1.4.1**
- **Operating system: Pi OS Bullseye**
- **Target hardware: Raspberry**

---

<div class="post-metadata">

**Author:** ![Hermit](http://forum.squareline.io/user_avatar/forum.squareline.io/hermit/32/971_2.png) [@Hermit](http://forum.squareline.io/u/Hermit)\
**Post date:** [June 13, 2024, 8:37am UTC](http://forum.squareline.io/t/raspberry-board-export-and-cmakelists-txt/3358/2 "2024-06-13T08:37:21Z")

</div>

This is not a bug per se, as the board-template is made for C in the first place. The `aarch64-linux-gnu` vs `aarch64-none-linux-gnu` difference is explained in the README and handled by .sh/.bat scripts if you use them, both are valid, depending on where you get it from. As usual, you’re free to modify the board-template to your needs, as you did here. Good to know these were the only modifications needed for C++. Thanks for sharing the information with the community.
