<?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>CMakeList.txt for a third-party external module</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100015/cmakelist-txt-for-a-third-party-external-module</link><description>Hi all: 
 I need some help in wrting the CMakeList.txt file for a third-party software module. My environment: windows10, nrf connect SDK v2.1.0. 
 The directory structure of my project is as below: 
 |-- .west |-- my_proj |-- CMakeLists.txt&amp;#185; |-- a_third_party_software_module_dir</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 02 Jun 2023 01:52:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100015/cmakelist-txt-for-a-third-party-external-module" /><item><title>RE: CMakeList.txt for a third-party external module</title><link>https://devzone.nordicsemi.com/thread/428874?ContentTypeID=1</link><pubDate>Fri, 02 Jun 2023 01:52:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44265fbd-d085-44b3-91b2-9d6450865110</guid><dc:creator>zhouwb</dc:creator><description>&lt;p&gt;Hi:&lt;/p&gt;
&lt;p&gt;Thanks for your answer!&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/100015/cmakelist-txt-for-a-third-party-external-module/428711"]Using&amp;nbsp;add_subdirectory() is what I am used to, and what I consider the formal way.[/quote]
&lt;p&gt;&lt;span&gt;Ok, I see.&lt;/span&gt;&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/100015/cmakelist-txt-for-a-third-party-external-module/428711"]Have you gotten any further on this?[/quote]
&lt;p&gt;As my previous post, I considered two candidates ways:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(1) set zephyr build options to target_build_options, then add_subdirectory;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;(2) declare the module as zephyr library and add all module source files to zephyr_library_sources.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;For (1), it didn&amp;#39;t go very smoothly, so I gave it up.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;I use (2) and it works for the present.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Maybe this is a case_by_case issue, so I want to close this issue.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;I am not familiar with rules in this nordic devzone, if I need do something to close, please notify me.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CMakeList.txt for a third-party external module</title><link>https://devzone.nordicsemi.com/thread/428711?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2023 11:47:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87da6eee-acdc-49e9-a967-a588d2bc97d4</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello again, and sorry about the delay&lt;/p&gt;
&lt;p&gt;It would be easier to consider this if you had a&amp;nbsp;problem getting something to work the way you wanted it to. Using&amp;nbsp;add_subdirectory() is what I am used to, and what I consider the formal way.&lt;/p&gt;
&lt;p&gt;For an example of it being used in a larger project with submodules I would recommend taking a look at the Asset Tracker application sample.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you gotten any further on this?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CMakeList.txt for a third-party external module</title><link>https://devzone.nordicsemi.com/thread/427055?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 02:07:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d118e132-e85e-4d43-9c6d-04636f635166</guid><dc:creator>zhouwb</dc:creator><description>&lt;p&gt;Hi Elfving:&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/100015/cmakelist-txt-for-a-third-party-external-module/426937"]Could you expand a bit on this? What do you find difficult&amp;nbsp;if the module&lt;span&gt;&amp;nbsp;&lt;/span&gt;was&lt;span&gt;&amp;nbsp;&lt;/span&gt;too big?[/quote]
&lt;p&gt;There is no difficulty really happens for the present. I &amp;quot;imagined&amp;quot; some difficulties( seems inconvenience is proper):&lt;/p&gt;
&lt;p&gt;(1) The 3rd-party module rely on a header file which is generated at build time;&lt;/p&gt;
&lt;p&gt;(2) One C source file in the 3rd-party moddule depends on another C source file, then I must understand the dependices.&lt;/p&gt;
&lt;p&gt;(3) ... ...&lt;/p&gt;
&lt;p&gt;If I use the cmake system in the 3rd-party module, these problem will be resolved by the system itself.&lt;/p&gt;
&lt;p&gt;Now if I try to define the build rules for the module in my cmake system, I must handle these problems.&lt;/p&gt;
&lt;p&gt;As my previous post, I googled some examples that does re-defined the build rules, bypassing the 3rd-party module&amp;#39;s cmake system. It make me doubt the meaning of the 3rd-party module provide the cmake system.&lt;/p&gt;
&lt;p&gt;I am now investigating if it is possible to write my&amp;nbsp;&lt;span&gt;CMakeLists.txt&amp;sup1; like below &amp;quot;fake&amp;quot; code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;target_compile_options(${3rd_party_module_target}, ${ZEPHYR_COMPILE_OPTIONS})&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;add_subdirectory(a_third_party_software_module_dir)&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please let me know your opinions.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:monospace;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CMakeList.txt for a third-party external module</title><link>https://devzone.nordicsemi.com/thread/426937?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 12:49:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea6837cc-dbdb-486e-baa7-392d0ee8e01c</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]Which means the build system in the third_party dir is not used. I think this is difficult when the third_party module is too big.[/quote]
&lt;p&gt;Could you expand a bit on this? What do you find difficult&amp;nbsp;if the module&lt;span&gt;&amp;nbsp;&lt;/span&gt;was&lt;span&gt;&amp;nbsp;&lt;/span&gt;too big?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>