<?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>What is the proper way to conditionally build?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112135/what-is-the-proper-way-to-conditionally-build</link><description>I am building (v2.5.0) for both the nrf52840dk and the nrf21540dk. 
 
 west build -b nrf21540dk_nrf52840 -d build21540 
 west build -b nrf52840dk_nrf52840 -d build52840 
 
 so I only want the following to compile with the nrf21540 build. 
 #FEM NRF21540</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jun 2024 12:54:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112135/what-is-the-proper-way-to-conditionally-build" /><item><title>RE: What is the proper way to conditionally build?</title><link>https://devzone.nordicsemi.com/thread/489106?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 12:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24f35954-f30e-416c-9e79-1bf6ee0c44f9</guid><dc:creator>mej7000</dc:creator><description>&lt;p&gt;Thanks! That makes perfect sense. &lt;br /&gt;&lt;br /&gt;To reiterate: &lt;span&gt;nrf21540dk_nrf52840.conf will be combined with prj.conf when&amp;nbsp;&lt;/span&gt;west build -b nrf21540dk_nrf52840 -d build21540 is executed (and obviously not combined when&amp;nbsp;west build -b nrf52840dk_nrf52840 -d build52840 is executed.)&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf21540dk_5F00_nrf52840.conf"&gt;devzone.nordicsemi.com/.../nrf21540dk_5F00_nrf52840.conf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the proper way to conditionally build?</title><link>https://devzone.nordicsemi.com/thread/489044?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 09:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5804864-e478-4fe5-8b59-6c75dc7b084d</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The proper way is to create a board-specific configuration in &amp;lt;your-project-directory&amp;gt;/boards which you name nrf21540dk_nrf52840.conf. Put the Kconfig symbols you only want for the nRF21540 DK build there. The build system will interpret the extra configuration file as a fragment which is added to the main configuration file (i.e. prj.conf).&lt;/p&gt;
&lt;p&gt;See also this documentation for general information on different configuration files: &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.5.0/page/nrf/config_and_build/multi_image.html#permanent_configuration_changes_to_child_images"&gt;https://docs.nordicsemi.com/bundle/ncs-2.5.0/page/nrf/config_and_build/multi_image.html#permanent_configuration_changes_to_child_images&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>