How to use pre-defined variable in CLion when setting environment variable - cmake

According to CLion, there are two pre-defined variable: $PROJECT_DIR$ and $USER_HOME$.
I would like to define an environment variable ASAN_OPTIONS, so that when I run sanity check, it will ignore the external libraries. There are two ways to set it, either from Preferences/Build, Execution, Deployment/CMake and set it in the specific cmake profile for sanity check , or from the Run/Build configurations.
I put the suppression file at the project root, and the executables will be in CMAKE_BINARY_DIR, either cmake-build-debug/tests/ or cmake-build-debug/tests/SubFolder.
So I set
ASAN_OPTIONS=detect_container_overflow=0 suppressions=$PROJECT_DIR$/MyASan.supp
However, $PROJECT_DIR$ is not parsed. What is the proper way to write it, and if this is possible?

Related

How to pass variables to MSBuild with VSTS

I'm looking at VSTS Build with the eyes of a Teamcity user. I'd like to set up multiple builds that each have the same set of parameters for MSBuild to use. For example, I'd like all my builds to share the CreateHardLinksForCopyFilesToOutputDirectoryIfPossible parameter.
I know I can manually write out /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true in each build configuration I set up, but I'd prefer to set this once using the variable system. However, when I set my variables using the variable editor, the VSTS agent converts variable names to upper case (as well as converting "." to "_" and other transforms), which means msbuild doesn't look at them (it was expecting the correct PascalCased version). I have verified this by echo-ing out all current environment variables, during build. I can't see any documentation on why this happens.
Is there a pattern to pass MSBuild parameters in via the variable system?
For VSTS variable name, it’s case-insensitive. You just need to focus on the variable’s value.
Such as if you have the variable tHisIsMixEdCase with the value /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true.
Then no matter to use $(THISISMIXEDCASE) or $(tHisIsMixEdCase) in MSBuild arguments option, both of them work same as using /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true directly.

In IAR v8.11, is there a predefined variable name for build configuration?

I am using IAR V 8.11.
I am currently using the build configuration to build for different platforms.
I want to be able to output the files that are generated from the build process into directories that are labelled with the build configuration name.
In order to do this, I need a variable name that has stores the build configuration, and use this variable name in the various project settings.
IAR (the IDE) provides access to custom argument variables via Tools->Configure Custom Argument Variables, but I was hoping there was a predefined variable already allocated for build configuration name.
So if I have several build configurations, Platform1, Platform2, it automatically updates the value of $VARIABLE_NAME$.
The best way to do this is to use the $CONFIG_NAME$ variable that is already available.
The value assigned to $CONFIG_NAME$ is the name of the build configuration, which is exactly what I wanted.

How do I access a variable from Bamboo in a Gradle script?

I am creating a deployment in Bamboo. I have some variables set up under the deployment plan. How can I access these from a Gradle script? There is an arguments input (that I guess I would use something like variable=${bamboo.variable} in there, but I cant work out how to get them to go through to the script (at the moment just doing something like prinln varible to get them out). How can I do this?
As far as I know, Bamboo exports all it's variable into the build environment. In that case, you can get any variable within the script as follows:
System.getenv('bamboo.variable')
Alternatively, you may pass it into the build as build script parameter, like so:
-Pvariable=${bamboo.variable}
and then you can get it within a script as a project property:
println variable

aggregate target + target paths

For one of my schemes I want to copy 2 folders into the final app bundle. For that I created an aggregate target with a copy build phase and added that target to the scheme where it should be triggered. That works fine, except for the target paths.
I appears something with the target paths is wrong however. In the copy build phase I can select whatever pre defined path exists in the drop down, the folder always end up in the same place ("Myproject/DerivedData/Myproject/Build/Products/Debug") instead of the app bundle. Is there something special to consider for aggregate targets?
I also tried to set a subpath with one of the build variables. They don't seem to be set however and have no effect. Setting a manual path works however. Though, I don't want to hard code my apps bundle name + Contents etc. if the normal way is usually to use an env var.
Btw. I also tried a script phase and checked the env vars printed in the build log. None contains the path to my app bundle (or parts of it below the Debug folder).
Maybe it has to do with the target type (aggregate target), I don't know. I couldn't get the predefined paths to work, they always seem to be empty. So, I ended up by hard coding the relative path (which rarely changes). But that is of course asking for trouble if I ever change the project's name.

Intellij 11.1.5 - Project specific path variable

I am using the Intellij 11.1.5. We are a large team, and have a pretty complex project setup. so we've made a template and when someone needs a new project set up, we just clone it and she is pretty much ready to go. One other thing i would like to automate is the creation of run configurations. One such configuration starts a custom bat file that requires a parameter representing a path that is user specific. I wanted to know if can store that value as a path variable specific to each project. Maybe somewhere in the .idea folder in my project. I know that Intellij stores it in its .IntelliJIdea11\config\options\path.macros.xml file, but is there a way to tweak that?
Any other idea that would allow me to locally store a parameter passed to the run config script would be usefull.
Thanks
I'm afraid you can't do it in IDEA, but you can use some environment variable directly in the .bat file instead of using the parameter (or rewrite the batch script to detect this value automatically, if possible). Instruct your users to define this environment variable.
IDEA Path variables are global and cannot be made project specific.