[CMake] COMPILER_LOADED vs ENABLED_LANGUAGES

🐋 Jan Hegewald jan.hegewald at awi.de
Mon Feb 29 10:24:00 EST 2016


Hi all,
I stumbled upon a problem where a find module did tests via "check_function_exists". It first checks if C is enabled via the ENABLED_LANGUAGES.
Now this does not seem to be reliable, as the project language is not C, but C is enables by a project included via add_subdirectory. Now ENABLED_LANGUAGES does contain C, but CMAKE_C_COMPILER_LOADED is false. This leads to an error from when calling check_function_exists is invoked.^1

Is this intended behaviour?
When to use ENABLED_LANGUAGES and when to use CMAKE_<lang>_COMPILER_LOADED?

Best,
Jan


1) CMake.app/Contents/share/cmake-3.4/Modules/CheckFunctionExists.cmake:67


More information about the CMake mailing list