|
7 | 7 | include_guard(GLOBAL)
|
8 | 8 |
|
9 | 9 | if(CONFIG_NCS_IS_VARIANT_IMAGE)
|
10 |
| - # A variant build should reuse same .config and thus autoconf.h, therefore |
11 |
| - # copy files from original and bypass Kconfig invocation. |
12 | 10 | set(AUTOCONF_H ${PROJECT_BINARY_DIR}/include/generated/zephyr/autoconf.h)
|
13 | 11 | set(DOTCONFIG ${PROJECT_BINARY_DIR}/.config)
|
14 | 12 |
|
15 |
| - set(preload_autoconf_h ${PRELOAD_BINARY_DIR}/zephyr/include/generated/zephyr/autoconf.h) |
16 |
| - set(preload_dotconfig ${PRELOAD_BINARY_DIR}/zephyr/.config) |
17 |
| - |
18 |
| - file(COPY ${preload_dotconfig} DESTINATION ${PROJECT_BINARY_DIR}) |
19 |
| - file(COPY ${preload_autoconf_h} DESTINATION ${PROJECT_BINARY_DIR}/include/generated/zephyr) |
20 |
| - file(APPEND ${AUTOCONF_H} "#define CONFIG_NCS_IS_VARIANT_IMAGE 1") |
21 |
| - |
22 | 13 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
|
23 | 14 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${DOTCONFIG})
|
24 |
| - set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${preload_autoconf_h}) |
25 |
| - set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${preload_dotconfig}) |
26 | 15 |
|
27 |
| - import_kconfig("CONFIG" ${DOTCONFIG}) |
| 16 | + if(CONFIG_NCS_VARIANT_MERGE_KCONFIG) |
| 17 | + # A variant build should reuse same .config and thus autoconf.h, therefore |
| 18 | + # copy files from original and bypass Kconfig invocation. |
| 19 | + set(preload_autoconf_h ${PRELOAD_BINARY_DIR}/zephyr/include/generated/zephyr/autoconf.h) |
| 20 | + set(preload_dotconfig ${PRELOAD_BINARY_DIR}/zephyr/.config) |
| 21 | + |
| 22 | + file(COPY ${preload_dotconfig} DESTINATION ${PROJECT_BINARY_DIR}) |
| 23 | + file(COPY ${preload_autoconf_h} DESTINATION ${PROJECT_BINARY_DIR}/include/generated/zephyr) |
| 24 | + |
| 25 | + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${preload_autoconf_h}) |
| 26 | + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${preload_dotconfig}) |
| 27 | + |
| 28 | + import_kconfig("CONFIG" ${DOTCONFIG}) |
| 29 | + else() |
| 30 | + # First generate autoconf.h as well as .config files. |
| 31 | + include(${ZEPHYR_BASE}/cmake/modules/kconfig.cmake) |
| 32 | + endif() |
| 33 | + |
| 34 | + file(APPEND ${AUTOCONF_H} "#define CONFIG_NCS_IS_VARIANT_IMAGE 1") |
28 | 35 | else()
|
29 | 36 | include(${ZEPHYR_BASE}/cmake/modules/kconfig.cmake)
|
30 | 37 | endif()
|
0 commit comments