Skip to content

Commit b28fcb0

Browse files
committed
Do not assume .config or CMakePresets
1 parent c89b858 commit b28fcb0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@ include_directories(lib/wolfssl)
5252
# Where should configuration values come from?
5353
# dot : parse .config via load_dot_config()
5454
# preset : use cacheVariables from CMakePresets.json
55-
set(WOLFBOOT_CONFIG_MODE "dot" CACHE STRING "Config source: dot or preset")
56-
set_property(CACHE WOLFBOOT_CONFIG_MODE PROPERTY STRINGS dot preset)
55+
if( EXISTS "./.config")
56+
message(STATUS "Found a .config file, will parse")
57+
set(WOLFBOOT_CONFIG_MODE "dot" CACHE STRING "Config source: dot or preset")
58+
set_property(CACHE WOLFBOOT_CONFIG_MODE PROPERTY STRINGS dot preset)
59+
else()
60+
message(STATUS "No .config file found.")
61+
endif()
5762

5863
if(WOLFBOOT_CONFIG_MODE STREQUAL "dot")
5964
message(STATUS "Config mode: dot (.config cache)")
@@ -65,7 +70,7 @@ elseif(WOLFBOOT_CONFIG_MODE STREQUAL "preset")
6570
message(STATUS "Config mode: preset (using cacheVariables; skipping .config)")
6671

6772
else()
68-
message(FATAL_ERROR "Invalid WOLFBOOT_CONFIG_MODE='${WOLFBOOT_CONFIG_MODE}'. Use 'dot' or 'preset'.")
73+
message(STATUS "Not using .config nor CMakePresets.json for WOLFBOOT_CONFIG_MODE.")
6974
endif()
7075

7176

0 commit comments

Comments
 (0)