Fix CMake missing build variables issue by adding C to LANGUAGES directive
Context
In the current project's CMake configuration, some machines (including mine) may face build issues due to missing build variables. This is caused by the lack of C language in the LANGUAGES directive of the CMakeLists.txt file, leading to errors in platforms that require this configuration.
Issue
When attempting to build the project, CMake returns error(s) stating that some variables are not properly set.
... [cmake] CMake Error: Error required internal CMake variable not set, cmake may not be built correctly. [cmake] Missing variable is: [cmake] CMAKE_C_COMPILE_OBJECT [cmake] CMake Error: Error required internal CMake variable not set, cmake may not be built correctly. [cmake] Missing variable is: [cmake] CMAKE_C_COMPILE_OBJECT [cmake] CMake Error: Error required internal CMake variable not set, cmake may not be built correctly. [cmake] Missing variable is: [cmake] CMAKE_C_COMPILE_OBJECT [cmake] -- Generating done (0.1s) [cmake] CMake Generate step failed. Build files cannot be regenerated correctly.
Fix
This pull request fixes the issue by adding the C language to the LANGUAGES directive in the CMakeLists.txt file. The updated directive now explicitly supports both C and C++ languages, ensuring proper build configuration.
Explanation
When trying to build, CMake fails to configure the necessary variables for the C language, resulting in errors. This happens because CMakeLists.txt does not explicitly declare the C language in the LANGUAGES directive, which can cause problems when building on certain platforms.
Testing
I reproduced the issue on different platforms:
- macOS Ventura 13.6.1
- cmake version 4.0.0
- clang version 14.0.3
- Ubuntu 24.04.2 LTS
- cmake version 3.28.3
- clang version 18.1.3
After the fix, the project built successfully on all tested platforms without errors related to missing build variables.