toolchainfile.cmake.in: do not force the CMAKE_{C, CXX}_FLAGS to the cache
authorSamuel Martin <s.martin49@gmail.com>
Thu, 21 Aug 2014 20:45:20 +0000 (22:45 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 28 Sep 2014 18:57:26 +0000 (20:57 +0200)
Fix #7280 [1]

When the FORCE option is passed to the set command, the variable is
added/updated in the CMake cache every single time CMake processes this
command.

Because the toolchainfile.cmake prepends architecture/toolchain flags
to the CMAKE_{C,CXX}_FLAGS, this makes the CFLAGS being updated in the
generated Makefiles each time one reconfigures its project. So it
forces the compilation of everything, even when nothing has changed.

[1] https://bugs.busybox.net/show_bug.cgi?id=7280

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(tested the SimpleApp reproduction scenario described in the bug report)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
support/misc/toolchainfile.cmake.in

index 1dfbdba2d11f8774ee1479d977da72bcd1bdf944..4ca3d35a30dfd6a357a71f9c8b04cdc583d98b21 100644 (file)
@@ -12,8 +12,8 @@ string(REPLACE "/usr/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST
 
 set(CMAKE_SYSTEM_NAME Linux)
 
-set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS" FORCE)
-set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS" FORCE)
+set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@ ${CMAKE_C_FLAGS}" CACHE STRING "Buildroot CFLAGS")
+set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@ ${CMAKE_CXX_FLAGS}" CACHE STRING "Buildroot CXXFLAGS")
 set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@ ${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Buildroot LDFLAGS")
 set(CMAKE_INSTALL_SO_NO_EXE 0)