[CMake] Build flags not applied during compiler testing on Ubuntu
Brad King
brad.king at kitware.com
Wed Aug 22 16:32:18 EDT 2018
On 08/22/2018 04:23 PM, Richard Shaw wrote:
> Currently I'm using an "include" of the toolchain file prior to calling
> "project" since 100% of development happens on a PC instead of having
> to pass the CMAKE_TOOLCHAIN_FILE option every time.
CMAKE_TOOLCHAIN_FILE must be used in order to be properly included
by try_compile projects and such. One can't just include() it
manually.
> Here's the contents:
>
> set(CMAKE_SYSTEM_NAME Generic)
> set(CMAKE_SYSTEM_PROCESSOR arm)
> set(CMAKE_SYSTEM_VERSION 1)
>
> # specify the cross compiler
> set(CMAKE_C_COMPILER arm-none-eabi-gcc)
> set(CMAKE_CXX_COMPILER arm-none-eabi-cpp)
Add
```
set(CMAKE_C_FLAGS_INIT "--specs=nosys.specs")
set(CMAKE_CXX_FLAGS_INIT "--specs=nosys.specs")
```
and be sure to use CMake 3.7 or higher.
-Brad
More information about the CMake
mailing list