I'm setting up a cross-compiling environment with CLion and need to execute a specific configuration script before configuring CMake.
I can do it in the command line as explained in this answer:
source /path/to/the-script
cmake -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX ...
Also, I can do it in VS Code through the CMake kits (.vscode/cmake-kits.json
):
[
{
"name": "ARM",
"environmentSetupScript": "/path/to/the-script"
}
]
Now I'd like to do the same in CLion but all that I can do is
Define all the environment variables manually using
-D
.Use a CMake toolchain file through
-DCMAKE_TOOLCHAIN_FILE
, but I don't have a .cmake file but a script. The script may change every time the toolchain is updated, so I'd like to avoid preparing one manually.
So, is there any way to execute the script before launching CMake in CLion?