I am currently playing around with CMake and want to detect the compiler and the compiler version. My current CMakeLists.txt looks as follows:
CMakeLists.txt
cmake
It might help you tell CMake that this is a C++ project. To do it you say it in the project command:
project
project ($(PROJECT) CXX) # ^^^ # Note project type
You might also want to do it before checking the variable.