[CMake] Set flags for compiler check

Richard Shaw hobbes1069 at gmail.com
Tue Jul 3 16:10:51 EDT 2018


I'm working on a cross-compiling project for the STM32F4 arm processor and
on my Fedora 28 system everything is working fine (cmake 3.11.2) but others
trying to configure are running into problems with the compiler check
failing.

Since I'm cross-compiling as far as I know I need "--specs=nosys.specs"
flag added for the compiler check to work which it is for me (relevant
output from CMakeOutput.log):

Building C object CMakeFiles/cmTC_2ac2b.dir/testCCompiler.c.o
/usr/lib64/ccache/arm-none-eabi-gcc   -Wall -std=gnu11 -mlittle-endian
-mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4
-fsingle-precision-constant -Wdouble-promotion -mfpu=fpv4-sp-d16
-mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1 --specs=nosys.specs    -o
CMakeFiles/cmTC_2ac2b.dir/testCCompiler.c.o   -c
/home/build/build/stm32/CMakeFiles/CMakeTmp/testCCompiler.c

But others have no flags being applied (cmake 3.9.1 on Ubuntu):

Building C object CMakeFiles/cmTC_01cf5.dir/testCCompiler.c.obj
/usr/bin/arm-none-eabi-gcc    -o
CMakeFiles/cmTC_01cf5.dir/testCCompiler.c.obj   -c
/home/david/codec2-dev/build_stm32b/CMakeFiles/CMakeTmp/testCCompiler.c

What is the right way to make sure flags are passed to the compiler check?

I assume I could use CMakeForceCompiler but that seems like a last resort...

Thanks,
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180703/c0ccfe23/attachment.html>


More information about the CMake mailing list