Find location of CMakeLists.txt in CLion Toolchain Environment file
Answered
I'm in a situation where I would like to know the location of the CMakeLists.txt I'm loading when the CLion Toolchains Environment File is executing. Say that I'm trying to load /home/user/project/CMakeLists.txt in CLion, then I would like to be able to use “/home/user/project/CMakeLists.txt” in my Toolchain environment file somehow. Maybe as an environment variable, or a function call. Is this possible? Is there a workaround?
${PWD} seemed promising at first, but it turns out its the location from where CLion was started, not the CMakeLists.txt that is being loaded.
Please sign in to leave a comment.
Hello!
CLion first sources the environment file and only after that loads a project (not the other way around). Also, toolchain settings are global settings, not project settings. In other words, at the moment when the environment file is sourced, there is no knowledge about the project. So, I think, it's not possible to achieve what you want.
Okay, thank you Anna.