Bug 7280 - CMake toolchain file uses the FORCE attribute on CMAKE_CXX_FLAGS
Summary: CMake toolchain file uses the FORCE attribute on CMAKE_CXX_FLAGS
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2014.05
Hardware: PC Linux
: P5 minor
Target Milestone: 2014.11
Assignee: Samuel Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-24 10:12 UTC by deblauwetom+buildroot
Modified: 2014-10-20 19:13 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
simple application to use with cmake toolchain (362 bytes, application/x-ms-download)
2014-07-24 12:57 UTC, deblauwetom+buildroot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description deblauwetom+buildroot 2014-07-24 10:12:18 UTC
It seems the cmake toolchain file generated by buildroot uses "FORCE" to set the CXX and C flags. However, this can be a problem. The toolchain file is read every run of cmake, so the CXX flags keep growing. This results in a complete rebuild everytime something changes in a CMakeLists.txt. CMake correctly thinks that it must rebuild everything because the CMAKE_CXX_FLAGS must be applied to all which you are compiling. It can be solved by removing the FORCE attribute of the set() command. The same goes for the CMAKE_C_FLAGS.
Comment 1 Thomas De Schampheleire 2014-07-24 12:43:15 UTC
Thanks for your bug report. Could you share a minimal .config and reproduction scenario (for cmake dummies)?

Ccing Samuel Martin...
Comment 2 deblauwetom+buildroot 2014-07-24 12:57:11 UTC
Created attachment 5522 [details]
simple application to use with cmake toolchain

Unzip this attachment, and then do this from the directory:

cd ..
mkdir buildSimpleApp
cd buildSimpleApp
cmake -DCMAKE_TOOLCHAIN_FILE=<full path to your buildroot compilation>/output/host/usr/share/buildroot/toolchainfile.cmake . ../SimpleApp/

This will work OK and generate makefiles. But if you run it again, you will see the build flags list grow and grow.
Comment 3 Thomas De Schampheleire 2014-08-09 11:30:56 UTC
Samuel, could you have a look at this maybe?
Comment 4 Samuel Martin 2014-08-09 11:52:26 UTC
(In reply to comment #3)
> Samuel, could you have a look at this maybe?

Yep, don't worry, I'm on it ;-)

So far, removing FORCE option in the toolchainfile.cmake.in looks ok, except for cdrkit :-/ I'll investigate this and hopefully post and fix during the rc month.

Regards,
Comment 5 Thomas Petazzoni 2014-08-16 13:43:24 UTC
Patch series sent by Samuel at http://lists.busybox.net/pipermail/buildroot/2014-August/104293.html.
Comment 6 Thomas De Schampheleire 2014-10-20 19:13:42 UTC
Bug fixed with commit http://git.buildroot.net/buildroot/commit/?id=47544e43a5e36f6c4ee1acb06315ab974cde78b4 and will be part of 2014.11.