Skip to content

Commit

Permalink
[nrf toup] cmake: kconfig: Remove unset + set of cache variables
Browse files Browse the repository at this point in the history
If this was done for because names overlapped, it's not needed any more
since now all cache variables have an image prefix (even app)

Signed-off-by: Øyvind Rønningstad <[email protected]>
  • Loading branch information
oyvindronningstad authored and SebastianBoe committed Aug 20, 2019
1 parent 1dc0ca5 commit 6e348b8
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions cmake/kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,15 @@ endforeach()

add_custom_target(${IMAGE}config-sanitycheck DEPENDS ${DOTCONFIG})

# Remove the CLI Kconfig symbols from the namespace and
# CMakeCache.txt. If the symbols end up in DOTCONFIG they will be
# re-introduced to the namespace through 'import_kconfig'.
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^${KCONFIG_CACHE_IMAGE_PREFIX}CONFIG_")
string(REPLACE "${KCONFIG_CACHE_IMAGE_PREFIX}" "" config_name ${name})
unset(${config_name})
unset(${name} CACHE)
endif()
endforeach()

# Parse the lines prefixed with CONFIG_ in the .config file from Kconfig
import_kconfig(CONFIG_ ${DOTCONFIG})

# Re-introduce the CLI Kconfig symbols that survived
# Clear CLI Kconfig symbols that were not set.
foreach (name ${cache_variable_names})
if("${name}" MATCHES "^${KCONFIG_CACHE_IMAGE_PREFIX}CONFIG_")
string(REPLACE "${KCONFIG_CACHE_IMAGE_PREFIX}" "" config_name ${name})
if(DEFINED ${config_name})
set(${name} ${${config_name}} CACHE STRING "")
if(NOT DEFINED ${config_name})
unset(${name} CACHE)
endif()
endif()
endforeach()

0 comments on commit 6e348b8

Please sign in to comment.