Error Building AU with CLion while Xcode builds without problems

I have a Mac OS-based plugin project, targeting Standalone, VST, AU and AAX, which builds fine with Xcode. As I prefer the CLion user interface over Xcode, I recently added a CLion exporter to the project. While building the standalone works out of the box, building all targets fails with the following error:

[ 93%] Built target AAX
Copying "MyPlugin.component" to "/Library/Audio/Plug-Ins/Components/"
Error copying directory from "/path/to/MyPlugin/Builds/CLion/cmake-build-debug/MyPlugin.component" to "/Library/Audio/Plug-Ins/Components/MyPlugin.component".
make[2]: *** [MyPlugin.component/Contents/MacOS/MyPlugin] Error 1

What could stop CLion to perform the copying-part? How could I get some more detailed error message? Did anyone else experience this error?

That doesn’t look right - the relevant part of CMakeLists.txt is

COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/MyPlugin.component" "$ENV{HOME}/Library/Audio/Plug-Ins/Components/MyPlugin.component"

so $ENV{HOME} is undefined. Are you running CLion in an unusual way, or as an unusual user?

What does echo $HOME print in the terminal?

No I’m running CLion in a completely usual way - it’s located in my Applications folder and I launch it through the Projucer or through the Mac OS Launchpad. echo $HOME
just prints out /Users/myusername and my user account is a regular Admin account. :thinking:

I’m afraid I don’t know what’s causing that then.

You can hard code the path to your home directory in CMakeLists.txt for a quick and dirty fix, though you’ll need to redo this every time you save your project in the Projucer.

I hand coded the path everywhere where an $ENV{HOME} appeared in the file. However I missed the COMMENT right after the copy operation.

Now it gets even more confusing. The build process still fails due to some other AU-related error I don’t really understand, but the COMMENT prints out the correct path to my users directory.

[ 93%] Built target AAX
Copying "MyPlugin.component" to "/Users/myusername/Library/Audio/Plug-Ins/Components/"
make[1]: *** [CMakeFiles/AU.dir/all] Error 2
make: *** [all] Error 2

But after all, as I’m still able to build everything right through Xcode I’m fine with excluding the AU build for the first time, as I’ll do most testing with other plugin formats.