/juce-cmake

CMake find module for the JUCE library

Primary LanguageCMakeMIT LicenseMIT

juce-cmake

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.

Announcement

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.

Design goals

  • 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

Example

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})

List of similar projects