Detailed steps on how to reproduce the bug
In JUCE/extras/Build/CMake/JUCEModuleSupport.cmake at line 47, there's a check:
if(NOT CMAKE_C_COMPILE_OBJECT)
message(FATAL_ERROR "A C compiler is required to build JUCE. Add 'C' to your project's LANGUAGES.")
endif()
This check runs at module scope when JUCEModuleSupport.cmake is included (via add_subdirectory(JUCE)). At that point, if the user's CMakeLists.txt only declares LANGUAGES CXX, the C compiler hasn't been initialized yet — even though JUCE's own juce_add_* macros call enable_language(C) later.
What is the expected behaviour?
With CMake 4.x, this causes a hard FATAL_ERROR:
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_C_COMPILE_OBJECT
With CMake 3.x it may work by accident since the variable gets set later.
Workaround: Users must add C to their project languages:
project(MyApp VERSION 1.0.0 LANGUAGES CXX C) # C required even if no C sources
Proposed fix: Move the CMAKE_C_COMPILE_OBJECT check from module scope into the juce_add_console_app, juce_add_gui_app, and juce_add_plugin functions — after the enable_language(C) call has had a chance to run.
Operating systems
Linux
What versions of the operating systems?
endeavourOS. It's an arch-based, so always latest.
Architectures
x86_64
Stacktrace
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
The bug is present on the develop branch
Code of Conduct
Detailed steps on how to reproduce the bug
In JUCE/extras/Build/CMake/JUCEModuleSupport.cmake at line 47, there's a check:
if(NOT CMAKE_C_COMPILE_OBJECT)
message(FATAL_ERROR "A C compiler is required to build JUCE. Add 'C' to your project's LANGUAGES.")
endif()
This check runs at module scope when JUCEModuleSupport.cmake is included (via add_subdirectory(JUCE)). At that point, if the user's CMakeLists.txt only declares LANGUAGES CXX, the C compiler hasn't been initialized yet — even though JUCE's own juce_add_* macros call enable_language(C) later.
What is the expected behaviour?
With CMake 4.x, this causes a hard FATAL_ERROR:
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_C_COMPILE_OBJECT
With CMake 3.x it may work by accident since the variable gets set later.
Workaround: Users must add C to their project languages:
project(MyApp VERSION 1.0.0 LANGUAGES CXX C) # C required even if no C sources
Proposed fix: Move the CMAKE_C_COMPILE_OBJECT check from module scope into the juce_add_console_app, juce_add_gui_app, and juce_add_plugin functions — after the enable_language(C) call has had a chance to run.
Operating systems
Linux
What versions of the operating systems?
endeavourOS. It's an arch-based, so always latest.
Architectures
x86_64
Stacktrace
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the
developbranchThe bug is present on the
developbranchCode of Conduct