<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to add header file (.h) and lib file (.lib) into custom project?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93149/how-to-add-header-file-h-and-lib-file-lib-into-custom-project</link><description>Hi all, 
 I am using NRF5340 with nRF Connect SDK v1.9.1. And I want to add my own .h and .lib(GCC) file into my project. 
 Please tell me how to do. 
 Thanks a lot!</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Oct 2022 07:33:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93149/how-to-add-header-file-h-and-lib-file-lib-into-custom-project" /><item><title>RE: How to add header file (.h) and lib file (.lib) into custom project?</title><link>https://devzone.nordicsemi.com/thread/392032?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2022 07:33:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7488e817-9b61-44c4-8631-d8594b995e84</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;It is quite a simple process to add libraries into your CMakeLists.txt file.&lt;/p&gt;
&lt;p&gt;There is a demo sample for this that you can try to understand that resides in&amp;nbsp;ncs\vx.x.x\zephyr\samples\application_development\external_lib&lt;/p&gt;
&lt;p&gt;If you open CMakeLists.txt file you can see how library is added to your project&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Create a wrapper CMake library that our app can link with
add_library(mylib_lib STATIC IMPORTED GLOBAL)
add_dependencies(
  mylib_lib
  mylib_project
  )

target_link_libraries(app PUBLIC mylib_lib)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in terms of adding a header file, you just need to add the &lt;a href="https://stackoverflow.com/questions/12857189/how-to-add-header-file-path-in-cmake-file"&gt;path of the header first in the same CMakeLists.txt&lt;/a&gt; file and you can include the header in the source file normally after that.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>