Most system package managers have packages for CMake, but we recommend using the most recent release from https://cmake.org/download. You should always use a CMake that's newer than your build toolchain, so that CMake can identify your build tools and understand how to invoke them.
In addition to CMake you'll need a build toolchain for your platform, such as Xcode or MSVC.
add_subdirectory
The simplest way to include JUCE in your project is to add JUCE as a
subdirectory of your project, and to include the line add_subdirectory(JUCE)
in your project CMakeLists.txt. This will make the JUCE targets and helper
functions available for use by your custom targets.
find_package
To install JUCE globally on your system, you'll need to tell CMake where to place the installed files.
# Go to JUCE directory
cd /path/to/clone/JUCE
# Configure build with library components only
cmake -B cmake-build-install -DCMAKE_INSTALL_PREFIX=/path/to/JUCE/install
# Run the installation
cmake --build cmake-build-install --target install
In your project which consumes JUCE, make sure the project CMakeLists.txt contains the line
find_package(JUCE CONFIG REQUIRED)
. This will make the JUCE modules and CMake helper functions
available for use in the rest of your build. Then, run the build like so:
# Go to project directory
cd /path/to/my/project
# Configure build, passing the JUCE install path you used earlier
cmake -B cmake-build -DCMAKE_PREFIX_PATH=/path/to/JUCE/install
# Build the project
cmake --build cmake-build
In the JUCE/examples/CMake directory, you'll find example projects for a GUI app, a console app,
and an audio plugin. You can simply copy one of these subdirectories out of the JUCE repo, add JUCE
as a submodule, and uncomment the call to add_subdirectory
where indicated in the CMakeLists.txt.
Alternatively, if you've installed JUCE using a package manager or the CMake install target, you can
uncomment the call to find_package
.
Once your project is set up, you can generate a build tree for it in the normal way. To get started, you might invoke CMake like this, from the new directory you created.
cmake -Bbuild (-GgeneratorName) (-DJUCE_BUILD_EXTRAS=ON) (-DJUCE_BUILD_EXAMPLES=ON)
This will create a build tree in a directory named ‘build’, using the CMakeLists in the current
working directory, using the default generator (makefiles on mac/linux, and the most recent Visual
Studio on Windows). You can choose a specific generator to use with the -G
flag (call cmake -G
to see a full list of generators on your platform). If you included JUCE as a subdirectory, you can
enable the Extras and Examples targets by including the last two arguments (they're off by default).
There's quite a lot of example projects, and generating project files might take a bit longer when
these options are on, so you probably won't want to include them most of the time.
Then, to build the project:
cmake --build build (--target targetNameFromCMakeLists) (--config Release/Debug/...)
This tells cmake to build the target named targetNameFromCMakeLists
, in the specified
configuration, using the appropriate tool. Of course, if you generated makefiles or ninja files, you
could call make
or ninja
in the build directory. If you generated an IDE project, like an Xcode
or Visual Studio project, then you could open the generated project in your IDE.
To build for iOS, you'll need CMake 3.14 or higher. Using the Xcode generator is highly recommended, as other generators may not automatically find the correct SDK for the iPhone simulator, and may fail to run certain parts of the build, such as compiling icons and processing the app's plist. By default, CMake will build for the same system that originally configured the project, so to enable cross-compilation for iOS, a few extra flags must be passed to the initial CMake invocation:
cmake -Bbuild-ios -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3
Here we create a build tree in the directory named ‘build-ios’, using the Xcode generator. The
-DCMAKE_SYSTEM_NAME=iOS
option tells CMake to enable cross-compiling for iOS. The
-DCMAKE_OSX_DEPLOYMENT_TARGET=9.3
option sets the minimum deployment target (it applies to iOS
despite the ‘OSX’ in the variable name!).
Once the project has generated, we can open it as normal in Xcode (look for the project file in the build directory). Alternatively, to build from the command-line, we could run this command:
cmake --build build-ios --target <targetName> -- -sdk iphonesimulator
Here, we're building the target named <targetName>
from the build tree in the directory
build-ios
. All the arguments after --
are ignored by CMake, and are passed through to the
underlying build tool. In this case, the build tool will be xcodebuild
because we used the Xcode
generator above. We tell xcodebuild that we're building the app for the iOS simulator, which doesn't
require special code signing.
If we wanted to build for a real device, we would need to pass some extra signing details to the initial CMake configuration command:
cmake -Bbuild-ios -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3 \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="iPhone Developer"
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=<10 character id>
The CODE_SIGN_IDENTITY
is the kind of certificate you want to use (iPhone Developer is appropriate
for development) and DEVELOPMENT_TEAM
is the 10-character ID that can be found by opening the
Keychain Access app, finding your development certificate, and checking its ‘Organizational Unit’
info field.
When building the target, you may also need to tell Xcode that it can automatically update
provisioning profiles, which is achieved by passing the -allowProvisioningUpdates
flag:
cmake --build build-ios --target <targetName> -- -allowProvisioningUpdates
CMake's out-of-the-box archiving behaviour doesn't always work as expected, especially for targets that depend on custom static libraries. Xcode may generate these libraries into a ‘DerivedData’ directory, but then omit this directory from the library search paths later in the build.
If the “Product -> Archive” action isn't working due to missing staticlibs, try setting the
ARCHIVE_OUTPUT_DIRECTORY
property explicitly:
set_target_properties(my_static_lib_target PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "./")
Note that the static library produced by juce_add_binary_data
automatically sets this property.
Building universal binaries that will run on both arm64 and x86_64 can be achieved by
configuring the CMake project with "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"
.
Clang-cl (Clang with MSVC-like command-line) should work by default. If you are generating a Visual Studio project, and have installed the LLVM package which is distributed with Visual Studio, then you can configure a Clang-cl build by passing “-T ClangCL” on your configuration commandline.
If you wish to use Clang with GNU-like command-line instead, you can pass
-DCMAKE_CXX_COMPILER=clang++
and -DCMAKE_C_COMPILER=clang
on your configuration commandline.
clang++ and clang must be on your PATH
for this to work. Only more recent versions of CMake
support Clang's GNU-like command-line on Windows. CMake 3.12 is not supported, CMake 3.15 has
support, CMake 3.20 or higher is recommended. Note that CMake doesn't seem to automatically link a
runtime library when building in this configuration, but this can be remedied by setting the
MSVC_RUNTIME_LIBRARY
property. See the official
documentation of this
property for usage recommendations.
Module options and plugin options that would previously have been set in the Projucer can be set on
a target-by-target basis in CMake, via target_compile_definitions
. To find the options exposed by
a particular module, check its module header for sections with the following structure:
/** Config: NAME_OF_KEY
Docs go here...
*/
#ifndef NAME_OF_KEY
#define NAME_OF_KEY ...
#endif
To override the default config option, use the following CMake code, replacing <value>
as
appropriate:
target_compile_definitions(my_target PUBLIC NAME_OF_KEY=<value>)
The JucePlugin_PreferredChannelConfig
preprocessor definition for plugins is difficult to specify
in a portable way due to its use of curly braces, which may be misinterpreted in Linux/Mac builds
using the Ninja/Makefile generators. It is recommended to avoid this option altogether, and to use
the newer buses API to specify the desired plugin inputs and outputs.
These flags can be enabled or disabled to change the behaviour of parts of the JUCE build.
These options would normally be configured by either:
-DNAME_OF_OPTION=ON/OFF
to the initial CMake configuration call,
orset(NAME_OF_OPTION ON/OFF)
before including JUCE in your project via add_subdirectory
or find_package
.JUCE_BUILD_EXTRAS
This controls whether targets are added for the projects in the ‘extras’ folder, such as the Projucer and AudioPluginHost. This is off by default, because you probably won't need these targets if you've included JUCE in your own project.
JUCE_BUILD_EXAMPLES
This controls whether targets are added for the projects in the ‘examples’ folder, such as the DemoRunner and PIPs. This is off by default, because you probably won't need these targets if you've included JUCE in your own project.
JUCE_ENABLE_MODULE_SOURCE_GROUPS
This option will make module source files browsable in IDE projects. It has no effect in non-IDE
projects. This option is off by default, as it will increase the size of generated IDE projects and
might slow down configuration a bit. If you enable this, you should probably also add
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
to your top level CMakeLists as this is required for
source grouping to work.
Source groupings are a little sensitive to the project layout. As such, you should always ensure
that the call to juce_add_module
which adds a specific module happens before calling
juce_add_*
to add any dependent targets.
The modules will be placed in a group named “JUCE Modules” within the group for each target, alongside the “Source Files” and “Header Files” groups.
Note: Source groups will only work when all JUCE-dependent targets are created using the
juce_add_*
functions. The standard add_executable
and add_library
commands are likely to
result in broken builds when source groups are enabled!
JUCE_COPY_PLUGIN_AFTER_BUILD
Controls whether plugin targets should be installed to the system after building. Note that the plugin folders may be protected, so the build may require elevated permissions in order for the installation to work correctly, or you may need to adjust the permissions of the destination folders.
JUCE_MODULES_ONLY
Only brings in targets for the built-in JUCE modules, and the juce_add_module*
CMake functions.
This is meant for highly custom use-cases where the juce_add_gui_app
and juce_add_plugin
functions are not required. Most importantly, the ‘juceaide’ helper tool is not built when this
option is enabled, which may improve build times for established products that use other methods to
handle plugin bundle structures, icons, plists, and so on. If this option is enabled, then
JUCE_ENABLE_MODULE_SOURCE_GROUPS
will have no effect.
juce_add_<target>
juce_add_gui_app(<target> [KEY value]...)
juce_add_console_app(<target> [KEY value]...)
juce_add_plugin(<target> [KEY value]...)
juce_add_gui_app
and juce_add_console_app
add an executable target with name <target>
.
juce_add_plugin
adds a ‘shared code’ static library target with name <target>
, along with extra
targets for each of the specified plugin formats. Each of these functions also takes a number of
optional arguments in the form of a KEY
followed by one or more value
s which can be used to set
additional attributes of the target. If these optional arguments aren't specified, their values will
fall back to sensible defaults.
Each of these arguments adds a property to the resulting target in the form JUCE_paramName
, where
paramName
is one of the parameter keys below. For example, after a call to
juce_add_gui_app(my_target PRODUCT_NAME "Target")
, the target my_target
will have a property
named JUCE_PRODUCT_NAME
with the value "Target"
. After creating a target with one of these
commands, properties beginning with JUCE_
can be queried, but changing their values might not
have any effect (or might even break things in unexpected ways!), so always pass JUCE target
attributes directly to these creation functions, rather than adding them later.
PRODUCT_NAME
OUTPUT_NAME
property. If not
specified, this will default to the target name.VERSION
VERSION
of
the project containing the target will be used instead. On Apple platforms, this is the
user-facing version string. This option corresponds to the CFBundleShortVersionString
field in
the target's plist.BUILD_VERSION
VERSION
of the target. On Apple platforms, this is the private version string used to
distinguish between App Store builds. This option corresponds to the CFBundleVersion
field in
the target's plist.BUNDLE_ID
COMPANY_NAME
and the name of the CMake target.MICROPHONE_PERMISSION_ENABLED
MICROPHONE_PERMISSION_TEXT
CAMERA_PERMISSION_ENABLED
CAMERA_PERMISSION_TEXT
BLUETOOTH_PERMISSION_ENABLED
BLUETOOTH_PERMISSION_TEXT
SEND_APPLE_EVENTS_PERMISSION_ENABLED
SEND_APPLE_EVENTS_PERMISSION_TEXT
FILE_SHARING_ENABLED
DOCUMENT_BROWSER_ENABLED
STATUS_BAR_HIDDEN
REQUIRES_FULL_SCREEN
BACKGROUND_AUDIO_ENABLED
BACKGROUND_BLE_ENABLED
APP_GROUPS_ENABLED
APP_GROUP_IDS
ICLOUD_PERMISSIONS_ENABLED
IPHONE_SCREEN_ORIENTATIONS
UIInterfaceOrientationUnknown
, UIInterfaceOrientationPortrait
,
UIInterfaceOrientationPortraitUpsideDown
, UIInterfaceOrientationLandscapeLeft
, or
UIInterfaceOrientationLandscapeRight
. Adds appropriate entries to an iOS app's plist.IPAD_SCREEN_ORIENTATIONS
UIInterfaceOrientationUnknown
, UIInterfaceOrientationPortrait
,
UIInterfaceOrientationPortraitUpsideDown
, UIInterfaceOrientationLandscapeLeft
, or
UIInterfaceOrientationLandscapeRight
. Adds appropriate entries to an iOS app's plist.LAUNCH_STORYBOARD_FILE
CUSTOM_XCASSETS_FOLDER
TARGETED_DEVICE_FAMILY
ICON_BIG
, ICON_SMALL
COMPANY_COPYRIGHT
JUCE_COMPANY_COPYRIGHT
property, so if you want to use the same
COMPANY_COPYRIGHT
for several targets in a build tree, you can call
set_directory_properties(PROPERTIES JUCE_COMPANY_COPYRIGHT ...)
after including JUCE but
before adding the targets, and then omit the COMPANY_COPYRIGHT
argument when creating the
individual targets.COMPANY_NAME
BUNDLE_ID
if no ID was given explicitly. The value of this argument
will be inherited from the JUCE_COMPANY_NAME
property, so if you want to use the same
COMPANY_NAME
for several targets in a build tree, you can call
set_directory_properties(PROPERTIES JUCE_COMPANY_NAME ...)
after including JUCE but before
adding the targets, and then omit the COMPANY_NAME
argument when creating the individual
targets.COMPANY_WEBSITE
JUCE_COMPANY_WEBSITE
property, so if you want to use the same
COMPANY_WEBSITE
for several targets in a build tree, you can call
set_directory_properties(PROPERTIES JUCE_COMPANY_WEBSITE ...)
after including JUCE but before
adding the targets, and then omit the COMPANY_WEBSITE
argument when creating the individual
targets.COMPANY_EMAIL
JUCE_COMPANY_EMAIL
property, so if you want to use the same COMPANY_EMAIL
for several
targets in a build tree, you can call set_directory_properties(PROPERTIES JUCE_COMPANY_EMAIL ...)
after including JUCE but before adding the targets, and then omit the COMPANY_EMAIL
argument when creating the individual targets.DOCUMENT_EXTENSIONS
jucer
because it wants to open .jucer
files. If your target has several different
document types, you can pass them as multiple arguments, e.g. DOCUMENT_EXTENSIONS wav mp3 aif
.NEEDS_CURL
TRUE
.NEEDS_WEB_BROWSER
TRUE
.NEEDS_STORE_KIT
TRUE
.PUSH_NOTIFICATIONS_ENABLED
NETWORK_MULTICAST_ENABLED
HARDENED_RUNTIME_ENABLED
HARDENED_RUNTIME_OPTIONS
HARDENED_RUNTIME_ENABLED
is TRUE
. Each key should be in the form
com.apple.security.*
where *
is a specific entitlement.APP_SANDBOX_ENABLED
APP_SANDBOX_INHERIT
TRUE
, no other app sandbox entitlements will be set on this target.APP_SANDBOX_OPTIONS
APP_SANDBOX_ENABLED
is TRUE
. Each key should be in the form com.apple.security.*
where *
is a specific entitlement.APP_SANDBOX_FILE_ACCESS_HOME_RO
APP_SANDBOX_ENABLED
is TRUE
.APP_SANDBOX_FILE_ACCESS_HOME_RW
APP_SANDBOX_ENABLED
is TRUE
.APP_SANDBOX_FILE_ACCESS_ABS_RO
APP_SANDBOX_ENABLED
is TRUE
.APP_SANDBOX_FILE_ACCESS_ABS_RW
APP_SANDBOX_ENABLED
is TRUE
.PLIST_TO_MERGE
FORMATS
Standalone Unity VST3 AU AUv3 AAX VST
. AU
and AUv3
plugins will only be enabled when building on macOS. It is an error to pass AAX
or VST
without first calling juce_set_aax_sdk_path
or juce_set_vst2_sdk_path
respectively.PLUGIN_NAME
PRODUCT_NAME
option). If not specified,
the PLUGIN_NAME
will default to match the PRODUCT_NAME
.PLUGIN_MANUFACTURER_CODE
PLUGIN_CODE
DESCRIPTION
IS_SYNTH
NEEDS_MIDI_INPUT
NEEDS_MIDI_OUTPUT
IS_MIDI_EFFECT
EDITOR_WANTS_KEYBOARD_FOCUS
DISABLE_AAX_BYPASS
DISABLE_AAX_MULTI_MONO
AAX_IDENTIFIER
BUNDLE_ID
by default.LV2URI
VST_NUM_MIDI_INS
VST_NUM_MIDI_OUTS
VST2_CATEGORY
kPlugCategUnknown
, kPlugCategEffect
, kPlugCategSynth
,
kPlugCategAnalysis
, kPlugCategMastering
, kPlugCategSpacializer
, kPlugCategRoomFx
,
kPlugSurroundFx
, kPlugCategRestoration
, kPlugCategOfflineProcess
, kPlugCategShell
,
kPlugCategGenerator
.VST3_CATEGORIES
Fx
, Instrument
, Analyzer
,
Delay
, Distortion
, Drum
, Dynamics
, EQ
, External
, Filter
, Generator
, Mastering
,
Modulation
, Mono
, Network
, NoOfflineProcess
, OnlyOfflineProcess
, OnlyRT
,
Pitch Shift
, Restoration
, Reverb
, Sampler
, Spatial
, Stereo
, Surround
, Synth
,
Tools
, Up-Downmix
AU_MAIN_TYPE
kAudioUnitType_Effect
, kAudioUnitType_FormatConverter
,
kAudioUnitType_Generator
, kAudioUnitType_MIDIProcessor
, kAudioUnitType_Mixer
,
kAudioUnitType_MusicDevice
, kAudioUnitType_MusicEffect
, kAudioUnitType_OfflineEffect
,
kAudioUnitType_Output
, kAudioUnitType_Panner
AU_EXPORT_PREFIX
AU_SANDBOX_SAFE
SUPPRESS_AU_PLIST_RESOURCE_USAGE
resourceUsage
key in the target's plist. This is useful for AU plugins that must access resources which cannot
be declared in the resourceUsage block, such as UNIX domain sockets. In particular,
PACE-protected AU plugins may require this option to be enabled in order for the plugin to load
in GarageBand.AAX_CATEGORY
AAX_ePlugInCategory_None
, AAX_ePlugInCategory_EQ
,
AAX_ePlugInCategory_Dynamics
, AAX_ePlugInCategory_PitchShift
, AAX_ePlugInCategory_Reverb
,
AAX_ePlugInCategory_Delay
, AAX_ePlugInCategory_Modulation
, AAX_ePlugInCategory_Harmonic
,
AAX_ePlugInCategory_NoiseReduction
, AAX_ePlugInCategory_Dither
,
AAX_ePlugInCategory_SoundField
, AAX_ePlugInCategory_HWGenerators
,
AAX_ePlugInCategory_SWGenerators
, AAX_ePlugInCategory_WrappedPlugin
,
AAX_EPlugInCategory_Effect
PLUGINHOST_AU
JUCE_PLUGINHOST_AU=1
to the new target, and will link the macOS frameworks necessary for
hosting plugins. Using this parameter should be preferred over using
target_compile_definitions
to manually set the JUCE_PLUGINHOST_AU
preprocessor definition.USE_LEGACY_COMPATIBILITY_PLUGIN_CODE
COPY_PLUGIN_AFTER_BUILD
JUCE_COPY_PLUGIN_AFTER_BUILD
on the directory before adding the
plugins, rather than setting this argument on each individual target. Note that on Windows,
the default install locations may not be writable by normal user accounts.VST_COPY_DIR
COPY_PLUGIN_AFTER_BUILD
is set on this target. If you want to install all of the VST2 plugins
in a subdirectory to a non-default location, you can set the JUCE_VST_COPY_DIR
property on
the directory before adding the plugin targets, rather than setting this argument on each
individual target.VST3_COPY_DIR
COPY_PLUGIN_AFTER_BUILD
is set on this target. If you want to install all of the VST3 plugins in a subdirectory to a
non-default location, you can set the JUCE_VST3_COPY_DIR
property on the directory before
adding the plugin targets, rather than setting this argument on each individual target.AAX_COPY_DIR
COPY_PLUGIN_AFTER_BUILD
is set on this target. If you want to install all of the AAX plugins in a subdirectory to a
non-default location, you can set the JUCE_AAX_COPY_DIR
property on the directory before
adding the plugin targets, rather than setting this argument on each individual target.AU_COPY_DIR
COPY_PLUGIN_AFTER_BUILD
is set on this target. If you want to install all of the AU plugins in a subdirectory to a
non-default location, you can set the JUCE_AU_COPY_DIR
property on the directory before
adding the plugin targets, rather than setting this argument on each individual target.UNITY_COPY_DIR
COPY_PLUGIN_AFTER_BUILD
is set on this target. If you want to install all of the Unity plugins in a subdirectory to a
non-default location, you can set the JUCE_UNITY_COPY_DIR
property on the directory before
adding the plugin targets, rather than setting this argument on each individual target.
Unlike the other COPY_DIR
arguments, this argument does not have a default value so be sure
to set it if you have enabled COPY_PLUGIN_AFTER_BUILD
and the Unity
format.IS_ARA_EFFECT
JucePlugin_Enable_ARA=1
, which can
be used in preprocessor conditions inside the plugin code. You should not add this definition
using target_compile_definitions
manually.ARA_FACTORY_ID
BUNDLE_ID
and VERSION
values. The version must be updated if e.g. the
plugin's (compatible) document archive ID(s) or its analysis or playback transformation
capabilities change.ARA_DOCUMENT_ARCHIVE_ID
ARA_ANALYSIS_TYPES
kARAContentTypeNotes
,
kARAContentTypeTempoEntries
, kARAContentTypeBarSignatures
, kARAContentTypeStaticTuning
,
kARAContentTypeKeySignatures
, kARAContentTypeSheetChords
ARA_TRANSFORMATION_FLAGS
kARAPlaybackTransformationNoChanges
. If the document controller has the ability to
provide the corresponding change it should be one or more of:
kARAPlaybackTransformationTimestretch
, kARAPlaybackTransformationTimestretchReflectingTempo
,
kARAPlaybackTransformationContentBasedFadeAtTail
,
kARAPlaybackTransformationContentBasedFadeAtHead
VST3_AUTO_MANIFEST
juce_enable_vst3_manifest_step
function. It is strongly recommended to generate a manifest for
your plugin, as this allows compatible hosts to scan the plugin much more quickly, leading to
an improved experience for users.juce_add_binary_data
juce_add_binary_data(<name>
[HEADER_NAME ...]
[NAMESPACE ...]
SOURCES ...)
Create a static library that embeds the contents of the files passed as arguments to this function.
Adds a library target called <name>
which can be linked into other targets using
target_link_libraries
.
The HEADER_NAME
argument is optional. If provided, the generated header will be given the
requested name, otherwise the generated header will be named “BinaryData.h”. In completely new
projects, you should provide a unique name here, so that projects containing more than one binary
data target are able to include the binary data headers without ambiguity.
The NAMESPACE
argument is also optional. If not provided, the generated files will use the default
namespace BinaryData
. Each of the files located at the paths following SOURCES
will be encoded
and embedded in the resulting static library. This library can be linked as normal using
target_link_libraries(<otherTarget> PRIVATE <name>)
, and the header can be included using
#include <BinaryData.h>
.
juce_add_bundle_resources_directory
juce_add_bundle_resources_directory(<target> <folder>)
Copy the entire directory at the location <folder>
into an Apple bundle's resource directory, i.e.
the Resources
directory for a macOS bundle, and the top-level directory of an iOS bundle.
juce_generate_juce_header
juce_generate_juce_header(<target>)
Introspects the JUCE modules that have been linked to <target>
and generates a JuceHeader.h
which contains #include
statements for each of the module headers. This header also contains an
optional using namespace juce
statement, and an optional ProjectInfo
block, each of which can be
disabled by setting the compile definitions DONT_SET_USING_JUCE_NAMESPACE
and
JUCE_DONT_DECLARE_PROJECTINFO
respectively. The resulting header can be included with #include <JuceHeader.h>
. In plain CMake projects which don't require Projucer compatibility, the use of
JuceHeader.h is optional. Instead, module headers can be included directly in source files that
require them.
juce_enable_copy_plugin_step
juce_enable_copy_plugin_step(<target>)
As an alternative to the JUCE_COPY_PLUGIN_AFTER_BUILD property, you may call this function to
manually enable post-build copy on a plugin. The argument to this function should be a target
previously created with juce_add_plugin
.
JUCE_COPY_PLUGIN_AFTER_BUILD will cause plugins to be installed immediately after building. This is
not always appropriate, if extra build steps (such as signing or modifying the plugin bundle) must
be executed before the install. In such cases, you should leave JUCE_COPY_PLUGIN_AFTER_BUILD
disabled, use add_custom_command(TARGET POST_BUILD)
to add your own post-build steps, and then
finally call juce_enable_copy_plugin_step
.
If your custom build steps need to use the location of the plugin artefact, you can extract this
by querying the property JUCE_PLUGIN_ARTEFACT_FILE
on a plugin target (not the shared code
target!).
juce_enable_vst3_manifest_step
juce_enable_vst3_manifest_step(<target>)
You may call this function to manually enable VST3 manifest generation on a plugin. The argument to
this function should be a target previously created with juce_add_plugin
.
VST3_AUTO_MANIFEST TRUE will cause the VST3 manifest to be generated immediately after building.
This is not always appropriate, if extra build steps (such as signing or modifying the plugin
bundle) must be executed before the plugin can be loaded. In such cases, you should set
VST3_AUTO_MANIFEST FALSE, use add_custom_command(TARGET POST_BUILD)
to add your own post-build
steps, and then finally call juce_enable_vst3_manifest_step
.
juce_set_<kind>_sdk_path
juce_set_aax_sdk_path(<absolute path>)
juce_set_vst2_sdk_path(<absolute path>)
juce_set_vst3_sdk_path(<absolute path>)
juce_set_ara_sdk_path(<absolute path>)
Call these functions from your CMakeLists to set up your local AAX, VST2, VST3 and ARA SDKs. These functions should be called before adding any targets that may depend on the AAX/VST2/VST3/ARA SDKs (plugin hosts, AAX/VST2/VST3/ARA plugins etc.).
juce_add_module
juce_add_module(<path to module>)
juce_add_modules(<names of module>...)
juce_add_module
adds a library target for the JUCE module located at the provided path. <path>
must be the path to a module directory (e.g. /Users/me/JUCE/modules/juce_core). This will add an
interface library with a name matching the directory name of the module. The resulting library can
be linked to other targets as normal, using target_link_libraries
.
Due to the way that INTERFACE
libraries work in CMake, linking to a module added in this way
must be done using PRIVATE
visibility. Using PUBLIC
will cause the module sources to be added
both to the target's SOURCES
and INTERFACE_SOURCES
, which may result in many copies of the
module being built into a single target, which would cause build failures in the best case and
silent ODR violations in the worst case. Scary stuff!
This command has a few optional arguments: INSTALL_PATH
is a path, relative to the install prefix,
to which the module sources will be copied during installation of the module. ALIAS_NAMESPACE will
add an alias for the module target(s) with the provided namespace. For example, the following
invocation will add a module target named my_module
, along with an alias named
company::my_module
. juce_add_module(my_module ALIAS_NAMESPACE company)`
juce_add_modules
is a convenience function that can be used to add multiple JUCE modules at once.
This version accepts many module paths, rather than just one. For an example of usage, see the
CMakeLists in the modules
directory.
juce_add_pip
juce_add_pip(<header>)
This function parses the PIP metadata block in the provided header, and adds appropriate build
targets for a console app, GUI app, or audio plugin. For audio plugin targets, it builds as many
plugin formats as possible. To build AAX or VST2 targets, call juce_set_aax_sdk_path
and/or
juce_set_vst2_sdk_path
before calling juce_add_pip
.
This is mainly provided to build the built-in example projects in the JUCE repo, and for building
quick proof-of-concept demo apps with minimal set-up. For any use-case more complex than a
proof-of-concept, you should prefer the juce_add_gui_app
, juce_add_plugin
, or
juce_add_console_app
functions, which provide more fine-grained control over the properties of
your target.
juce_disable_default_flags
juce_disable_default_flags()
This function sets the CMAKE_<LANG>_FLAGS_<MODE>
to empty in the current directory and below,
allowing alternative optimisation/debug flags to be supplied without conflicting with the
CMake-supplied defaults.
juce_link_with_embedded_linux_subprocess
juce_link_with_embedded_linux_subprocess(<target>)
This function links the provided target with an interface library that generates a barebones
standalone executable file and embeds it as a binary resource. This binary resource is only used
by the juce_gui_extra
module and only when its JUCE_WEB_BROWSER
capability is enabled. This
executable will then be deployed into a temporary file only when the code is running in a
non-standalone format, and will be used to host a WebKit view. This technique is used by audio
plugins on Linux.
This function is automatically called if necessary for all targets created by one of the JUCE target
creation functions i.e. juce_add_gui_app
, juce_add_console_app
and juce_add_gui_app
. You don't
need to call this function manually in these cases.
juce::juce_recommended_warning_flags
target_link_libraries(myTarget PUBLIC juce::juce_recommended_warning_flags)
This is a target which can be linked to other targets using target_link_libraries
, in order to
enable the recommended JUCE warnings when building them.
This target just sets compiler and linker flags, and doesn't have any associated libraries or
include directories. When building plugins, it's probably desirable to link this to the shared code
target with PUBLIC
visibility, so that all the plugin wrappers inherit the same compile/link
flags.
juce::juce_recommended_config_flags
target_link_libraries(myTarget PUBLIC juce::juce_recommended_config_flags)
This is a target which can be linked to other targets using target_link_libraries
, in order to
enable the recommended JUCE optimisation and debug flags.
This target just sets compiler and linker flags, and doesn't have any associated libraries or
include directories. When building plugins, it's probably desirable to link this to the shared code
target with PUBLIC
visibility, so that all the plugin wrappers inherit the same compile/link
flags.
juce::juce_recommended_lto_flags
target_link_libraries(myTarget PUBLIC juce::juce_recommended_lto_flags)
This is a target which can be linked to other targets using target_link_libraries
, in order to
enable the recommended JUCE link time optimisation settings.
This target just sets compiler and linker flags, and doesn't have any associated libraries or
include directories. When building plugins, it's probably desirable to link this to the shared code
target with PUBLIC
visibility, so that all the plugin wrappers inherit the same compile/link
flags.