This project is an attempt at providing CMake support for the JUCE library, inspired by the standard CMake module FindBoost.
Thanks to the simple JUCE Module Format specifications, intermodule and external dependencies are resolved by inspecting each module header file for properties and configuration flags. This is similar to the way the Projucer handles modules.
JUCE 6 now has built-in official cmake support which is almost a drop-in replacement for juce-cmake. Since there is no reason to duplicate efforts, juce-cmake will not be actively maintained anymore. Feel free to fork it if required.
- Avoid having to rely on the Projucer and allow pure CMake builds.
- Try to favour standard CMake constructs over helper functions as much as possible.
- Rely on find_package to locate and configure JUCE.
- Rely on INTERFACE targets for each module to propagate transitive dependencies.
- Rely on target_sources to postpone building the JUCE sources with the dependent target.
- Avoid polluting the source directory with JuceLibraryCode, instead favour autogenerated files in the build directory.
- support multiple calls to find_package(JUCE) to allow multiple sub projects to be built with different modules
cmake_minimum_required(VERSION 3.0)
project(HelloWorld)
find_package(JUCE REQUIRED
COMPONENTS
juce_core
juce_data_structures
juce_events
juce_graphics
juce_gui_basics
juce_gui_extra
)
set(SOURCES
Main.cpp
MainComponent.h
MainComponent.cpp
)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
target_link_libraries(${PROJECT_NAME} ${JUCE_LIBRARIES})
source_group(Source FILES ${SOURCES})
- JUCE.cmake is a similar and much more advanced project. However it relies on the Projucer.
- https://github.com/teragonaudio/CMakeJuce
- https://github.com/nclack/cmake-juce
- https://github.com/shaduzlabs/audio-plugin-project-template