-
Notifications
You must be signed in to change notification settings - Fork 16
Setting language‐specific target options
Felipe Torrezan edited this page Apr 13, 2024
·
2 revisions
When a CMake target uses multiple programming languages, the Assembler and the Compiler might require different options.
- CMake targets using multiple programming languages.
A CMake target composed of mixed Assembly and C source code where the C portion of the application would require to be compiled with the full C Runtime Library (for its complete printf()
capabilities), generator expressions (or simply "genex") can be used to specify that this option is only applicable when compiling C source files:
-
CMakeLists.txt
:
target_compile_options(myTarget PRIVATE
$<$<COMPILE_LANGUAGE:C>:--dlib_config full> --cpu=cortex-m4)
In the above example C source files built for myTarget
will be compiled with the full runtime library option and the CPU option whereas any Assembly source files will only get the CPU option.
This is the cmake-tutorial wiki. Back to Wiki Home
- Setting language-specific target options
- Selecting build types
- Using Ninja Multi-Config
- Filing a build log
- Multi-file compilation
- Invoking IAR binary utilities