# How do angle-brackets varaibles get expanded (e.g. \<LINK\_FLAGS\>)? Can you add new ones?

**URL:** https://discourse.cmake.org/t/how-do-angle-brackets-varaibles-get-expanded-e-g-link-flags-can-you-add-new-ones/4488
**Category:** Code
**Tags:** os:linux, gen:makefiles
**Created:** [November 15, 2021, 3:44pm UTC](https://discourse.cmake.org/t/how-do-angle-brackets-varaibles-get-expanded-e-g-link-flags-can-you-add-new-ones/4488 "2021-11-15T15:44:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shabiel](https://discourse.cmake.org/user_avatar/discourse.cmake.org/shabiel/32/1285_2.png) [@shabiel](https://discourse.cmake.org/u/shabiel)
#### Post date: [November 15, 2021, 3:44pm UTC](https://discourse.cmake.org/t/how-do-angle-brackets-varaibles-get-expanded-e-g-link-flags-can-you-add-new-ones/4488/1 "2021-11-15T15:44:36Z")

</div>

Hello everybody,

This is yet another followup to [Need CMake M Plugin help: Single target, Single source, multiple objects, multiples libraries](https://discourse.cmake.org/t/need-cmake-m-plugin-help-single-target-single-source-multiple-objects-multiples-libraries/2951).

Lots of thinking makes me convinced that the solution cannot be provided by CMake natively, but I think I can cajole CMake into doing the right thing. I can do it by providing a macro that will create 2 targets with different compilation “flags”. I say “flags”, but our compiler doesn’t really use flags, but rather environment variables, but that’s not an issue as I can achieve the same effect. My question is how can I make the targets take different compilation flags?

The two targets need to be compiled differently as follows:

```auto
1. ydb_chset="utf-8" $ydb_dist/yottadb <SOURCE>
2. ydb_chset="M" $ydb_dist/yottadb <SOURCE>

```

This is my current CMake Plugin compiler rule:

```auto
(CMAKE_M_COMPILE_OBJECT "LC_ALL=\"${LC_ALL}\" ydb_chset=\"${ydb_chset}\" ydb_icu_version=\"${icu_version}\" <CMAKE_M_COMPILER> -object=<OBJECT>")

```

I was reading the CMake source code and some example modules. I saw this example:

```auto
  set(CMAKE_Swift_CREATE_STATIC_LIBRARY "<CMAKE_Swift_COMPILER> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -j ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")

```

Therefore, ideally, I would like my build system to be able to specify the angle bracket variable per target, which would accomplish what I want. So the question is:

1. How does CMake determine what the angle bracket variables are? Can you set them per target?
2. Can you define new angle bracket variables?

–Sam

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 15, 2021, 5:24pm UTC](https://discourse.cmake.org/t/how-do-angle-brackets-varaibles-get-expanded-e-g-link-flags-can-you-add-new-ones/4488/2 "2021-11-15T17:24:55Z")

</div>

> [@shabiel](#):
>
> 1. How does CMake determine what the angle bracket variables are? Can you set them per target?

They’re internal things to the generators (namely the non-IDE generators; I don’t think the IDEs use these templates).

> [@shabiel](#):
>
> 1. Can you define new angle bracket variables?

Not without editing CMake’s source itself. I think this will need some new logic in CMake to support these compilers.

Cc: @brad.king
