In CMakeLists.txt
, is there a way to know whether the file was executed from a terminal or via a gui (of some form, e.g. ccmake
or cmake-gui
)? CMAKE_COMMAND
and CMAKE_EDIT_COMMAND
are both populated regardless of whether I am running cmake
or ccmake
.
I was searching through the variables and these two seemed the most promising. I have become enamored with colorizing cmake output, the many wonderful answers there have their drawbacks. Namely, I can either get:
- It works as expected in a terminal, but there are escape sequences in
ccmake
. - It works as expected in a terminal, but the
ccmake
terminal is overwritten by colorized output (LOL).
Just curious if there is a way to determine this in the CMakeLists.txt
. There were variables for script mode (-P
) that seemed potentially helpful, but I think I would first need to know which executable (cmake
or ccmake
) called my CMakeLists.txt
in the first place.