# Need help to add unit test with googletest for a Cortex M0

**URL:** https://discourse.cmake.org/t/need-help-to-add-unit-test-with-googletest-for-a-cortex-m0/11542
**Category:** Code
**Tags:** os:linux
**Created:** [August 28, 2024, 6:13pm UTC](https://discourse.cmake.org/t/need-help-to-add-unit-test-with-googletest-for-a-cortex-m0/11542 "2024-08-28T18:13:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gibsonprs](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/b5a626/32.png) [@gibsonprs](https://discourse.cmake.org/u/gibsonprs)
#### Post date: [August 28, 2024, 6:13pm UTC](https://discourse.cmake.org/t/need-help-to-add-unit-test-with-googletest-for-a-cortex-m0/11542/1 "2024-08-28T18:13:07Z")

</div>

Good afternoon,  
I just discover googletest and i am a newbie on it.  
I have a project devlopped for cortexM0 . The build environment is linux through CMake…  
The project used a gcc -arm compiler.  
I am trying to add unit test to this project.  
So i started to add the googletest environement and also start to write a test .  
For the unit test, i am using ubuntu GCC compiler.  
The unittest compiles but does not link due to missing reference.

Basically, from the initial project, i m just trying to test one specific function of a specific file (let s call it specific\_file.c) of my project. The initial project includes a lot of file including hte ASF framework.

I don t know how to correctly build the unit tests CMakelists.txt to do it.  
Shall it includes only the source files related to the unit test + the source file of the project (specific\_file.c) or should it lloks like the initial project ?

May i have chat with an expert to help me?

Thank you

gibson
