Compiler detection in CMake across all languages ( C++, C, CUDA ) is the expectation that it is possible to run a simple executable in the current environment to extract compiler vendor name, and other information.
You can try to setup a toolchain file that specifies all the required information ( compiler vendor, etc ) that the executable outputs, and set CMAKE_TRY_COMPILE_TARGET_TYPE
to STATIC_LIBRARY.