Skip to content

Commit 5ab6ffb

Browse files
committed
improve sed in cmake to avoid recompile due to regenerating sdkconfig
1 parent 4ff3a38 commit 5ab6ffb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ add_custom_command(
4949
add_custom_target(Template SOURCES templates.hpp)
5050
add_dependencies(${COMPONENT_LIB} Template)
5151

52-
# Disable CONFIG_LWIP_IPV6 in sdkconfig
52+
# Disable CONFIG_LWIP_IPV6 in `sdkconfig` in build process
53+
## This realizes the same behavior by `idf.py menuconfig`.
54+
## However, you need to do `idf.py build` twice to refrect
55+
## all the settings properly.
56+
message(STATUS "PROJECT=${PROJECT_NAME}")
5357
add_custom_command(
5458
OUTPUT sdkconfig
55-
COMMAND sed -i 's/CONFIG_LWIP_IPV6=y/CONFIG_LWIP_IPV6=n/g' ${CMAKE_SOURCE_DIR}/sdkconfig)
59+
COMMAND grep -q CONFIG_LWIP_IPV6=y ${CMAKE_SOURCE_DIR}/sdkconfig || exit 0 && sed -i 's/CONFIG_LWIP_IPV6=y/CONFIG_LWIP_IPV6=n/g' ${CMAKE_SOURCE_DIR}/sdkconfig)
5660
add_custom_target(Sdkconfig SOURCES sdkconfig)
5761
add_dependencies(${COMPONENT_LIB} Sdkconfig)

0 commit comments

Comments
 (0)