I am having some trouble getting my plugin to build in release mode, because I cannot correctly get CMake to set the BUILD_TYPE to “Release”. I am using a custom bash script to do it that uses an environment variable, BUILD_TYPE, to use the command cmake -B build -DCMAKE_BUILD_TYPE="$BUILD_TYPE".
I guess my question is do I use a flag and value in the build command or is this something I declare with CMake? If the latter, can I supply it an environment variable from my bash script?
Which generator are you using? Only the single-configuration generators like GNU Makefiles and Ninja support CMAKE_BUILD_TYPE. For multi-config generators like Xcode and Visual Studio, the configuration can be chosen at build time, e.g.
Not entirely sure, but am nearly certain that I am using a multi-config one, most likely for VS2019.
But your answer solved my problem - I was just setting the configuration with a wrong flag. Thanks!
Edit - Except, now the command when using --config Release only builds a Plugin_SharedCode.lib file and no VST3 file. Do you know why this might be happening? Normally the execution continues after generating the base libraries from juce, but it’s now stopping before it starts generating the various platform code.
Here is some sample output:
Building (Garm)...
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking File Globs
Checking Build System
Generating Garm_artefacts/JuceLibraryCode/JuceHeader.h
Building Custom Rule C:/dev/repos/audio/garm/Garm/CMakeLists.txt
GarmEditor.cpp
GarmProcessor.cpp
juce_audio_plugin_client_utils.cpp
juce_audio_utils.cpp
juce_audio_processors.cpp
juce_gui_extra.cpp
juce_gui_basics.cpp
juce_graphics.cpp
juce_events.cpp
juce_core.cpp
juce_data_structures.cpp
juce_audio_basics.cpp
juce_audio_formats.cpp
juce_audio_devices.cpp
Generating Code...
Garm.vcxproj -> C:\dev\repos\audio\garm\build\Garm\Garm_artefacts\Debug\Garm_SharedCode.lib
Nevermind… it worked when I removed the --target Plugin flag from the commend, because my debug config had stopped working as well, but it’s fixed now. Doesn’t this mean I don’t have my target properly setup?