<?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>Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107473/using-application-defined-kconfig-option-in-cmakelists</link><description>Hi, 
 In our application we have custom Kconfig flag defined to wrap other Kconfig options and conditionally compile application files. However this Kconfig, name it CONFIG_X, is not visible in the application CMakeList.txt file unless it&amp;#39;s forwarded</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Jan 2024 08:26:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107473/using-application-defined-kconfig-option-in-cmakelists" /><item><title>RE: Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/thread/466405?ContentTypeID=1</link><pubDate>Mon, 29 Jan 2024 08:26:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c46b297-3d3c-4e4e-86ff-b5f3c3fc36bc</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Nathan45"]I need to set a build flag related to a device tree overlay based on my prj.conf.[/quote]
&lt;p&gt;prj.conf::CONFIG_X=y, should then include a dts overlay.&lt;/p&gt;
&lt;p&gt;I have not seen any samples of doing this directly, as you mention; the ordering will be incorrect.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to differentiate based on the board itself instead?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/thread/466317?ContentTypeID=1</link><pubDate>Sat, 27 Jan 2024 00:04:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a0f96d1-deff-4947-bb3a-f2a5938094b0</guid><dc:creator>Nathan45</dc:creator><description>&lt;p&gt;I have a similar issue. I need to set a build flag related to a device tree overlay based on my prj.conf. However, this doesn&amp;#39;t seem to work since the prj.conf doesn&amp;#39;t get loaded in until after the find_package(...). But after the find_package(...) it&amp;#39;s too late to configure the device tree (according to the error I get.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what to do&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/thread/464668?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 16:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6db96a01-63f1-4a12-a97f-2874afd216e0</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="george232"]Ahhh I see. Kconfig is simply parsed after I do the check the reason because `find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})` executed to late in my CMakeList.txt... sorry for bothering.[/quote]
&lt;p&gt;No bother! I&amp;#39;m glad to hear that you found a solution. Let me know if there&amp;#39;s anything else that pops up. Hope you have a wonderful day!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/thread/464632?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 14:12:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d52bb77-aa21-4307-b6c0-9c0823f14e51</guid><dc:creator>george232</dc:creator><description>&lt;p&gt;Ahhh I see. Kconfig is simply parsed after I do the check because `find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})` is executed too late in my CMakeList.txt... sorry for bothering.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/thread/464608?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 13:30:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e2ef463-045a-4c39-8ea3-8dce42609982</guid><dc:creator>george232</dc:creator><description>&lt;p&gt;Sorry, I guess I limited the scope of operations executed in the if branch to compilation of files, where in fact apart from that I need to, among others, set PM_STATIC_YML_FILE and EXTRA_CONFIG_FILE.&lt;br /&gt;&lt;br /&gt;I guess target_sources_ifdef will work for pulling the files in, but it won&amp;#39;t solve my problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using application defined Kconfig option in CMakeLists</title><link>https://devzone.nordicsemi.com/thread/464590?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2024 12:53:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e85708e8-f13d-4451-887b-f8d5eae860e2</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to use the target_sources_ifdef() instead?&lt;/p&gt;
&lt;p&gt;Here is an example:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/applications/asset_tracker_v2/src/modules/CMakeLists.txt#L9C1-L9C1"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.5.1/applications/asset_tracker_v2/src/modules/CMakeLists.txt#L9C1-L9C1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>