[OpenWrt-Devel] cmake.mk: ignores package CFLAGS

Yousong Zhou yszhou4tech at gmail.com
Sun Feb 1 07:27:00 EST 2015


Hi,  Rafał Miłecki


On 1 February 2015 at 18:59, Rafał Miłecki <zajec5 at gmail.com> wrote:
> On 9 January 2015 at 10:51, Rafał Miłecki <zajec5 at gmail.com> wrote:
>> If you look at include/cmake.mk you will notice followiing:
>> -DCMAKE_BUILD_TYPE=Release
>> It means that CMake uses CMAKE_C_FLAGS_RELEASE
>>

I am a newcomer at cmake, but it means that CMake will use
CMAKE_C_FLAGS_RELEASE in addition to CMAKE_C_FLAGS.  CMAKE_C_FLAGS
will be used for all build types.

>>
>> I've created package and tested it using two variants:
>>
>> 1) TARGET_CFLAGS=-DFOO
>> This is what I got:
>> grep FOO build_dir/target-*/test/CMakeCache.txt
>> CMAKE_CXX_FLAGS:STRING='-DFOO  '
>> CMAKE_C_FLAGS:STRING='-DFOO  '
>> My app was compiled *without* FOO
>>
>> 2) CMAKE_OPTIONS=-DCMAKE_C_FLAGS_RELEASE="-DFOO"
>> This is what I got:
>> grep FOO build_dir/target-*/test/CMakeCache.txt
>> CMAKE_C_FLAGS_RELEASE:STRING=-DFOO
>> My app was compiled *with* FOO
>>
>>
>> I think there is a bug in cmake.mk. Since we use
>> -DCMAKE_BUILD_TYPE=Release
>> we can't really relay on
>> CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"
>> because it will result in
>> CMAKE_C_FLAGS
>> instead of
>> CMAKE_C_FLAGS_RELEASE
>

Hmm, I think CMAKE_C_FLAGS_RELEASE=-DNDEBUG is fine at the moment.

Regards

                yousong


> Ping?
>
> --
> Rafał
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list