Support CFLAGS
Created by: dvyukov
I am trying to figure out how to pass additional CFLAGS when building libraries. The only option I found that works now is overriding CC to include a compiler with the flags:
(rm -rf dynamorio-test && mkdir -p dynamorio-test && cd dynamorio-test && \
CC="gcc -fsanitize=address" cmake -GNinja ../third_party/dynamorio && \
ninja libdrdecode.a && \
objdump -d lib64/libdrdecode.a | grep 0x7fff8000 | wc -l)
4141
But the following options don't work
(rm -rf dynamorio-test && mkdir -p dynamorio-test && cd dynamorio-test && \
CFLAGS="-fsanitize=address" cmake -GNinja ../third_party/dynamorio && \
ninja libdrdecode.a && \
objdump -d lib64/libdrdecode.a | grep 0x7fff8000 | wc -l)
0
and:
(rm -rf dynamorio-test && mkdir -p dynamorio-test && cd dynamorio-test && \
cmake -GNinja -DCMAKE_C_FLAGS="-fsanitize=address" ../third_party/dynamorio && \
ninja libdrdecode.a && \
objdump -d lib64/libdrdecode.a | grep 0x7fff8000 | wc -l)
0
Overriding CC
is quite inconvenient when combined with cross-compilation/toolchains.
I see docs mention setting CFLAGS=-m32
. I am not sure if this broken, or wasn't supported, or I am holding it wrong...