Sharing CMake variables between profiles

Answered

Hi,

TL;DR: Is there a way to have some CMake variable shared between all of my CMake profiles?

I don't want to have to write the following in each profile:

-DMY_VAR=foo

Thanks!

--------------------------

Background:

I have a project that has hundreds of targets, and we often compile each target separately.

The target is passed as a CMake variable (which CMake later compiles using ${TARGET}).

Therefore I have a profile set up in CLion for each target that I want to compile.

However, besides TARGET, there are several other options that never change, e.g., a variable called MY_VAR should always return foo when I invoke cmake.

Can I set up CLion such that in all of the profiles the variable MY_VAR equals "foo" ?

(to clarify, I don't want to touch the actual CMakeLists.txt file, so environment variables for example are not an option. I am looking for a solution within CLion's settings).

Regards

0
2 comments
Avatar
Permanently deleted user

this is marked as answered but isn't, in fact, answered...

0

Hi Alon!

Sorry, I wrote an answer, but then realized that it was incorrect and deleted it, but forgot to remove the "Answered" tag. I wasn't able to come up with a solution for your scenario. Feel free to create a feature request in out tracker: https://youtrack.jetbrains.com/issues/CPP.

0

Please sign in to leave a comment.