I’m running a PlatformIO project in CLion, and I’m using
CMakeListsUser.txt to include config for a JUCE project:
# CMakeListsUser.txt if (NOT CMAKE_BUILD_TYPE MATCHES "[platformio-env]") # Unset some stuff set by pio; allow JUCE to set these to its own liking. unset(CMAKE_C_COMPILER) unset(CMAKE_CXX_COMPILER) unset(CMAKE_CXX_FLAGS) unset(CMAKE_C_FLAGS) # pio sets CMAKE_SYSTEM_NAME to 'Generic'; update this for JUCE's benefit. execute_process(COMMAND uname -s OUTPUT_VARIABLE CMAKE_SYSTEM_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) add_subdirectory(wfs-controller) endif ()
wfs-controller/CMakeLists.txt is a regular JUCE CMake file
cmake_minimum_required(VERSION 3.15) project(WFS_CONTROLLER VERSION 0.0.6) list(APPEND CMAKE_PREFIX_PATH ~/.local/share/JUCE) find_package(JUCE CONFIG REQUIRED) juce_add_gui_app(WfsController PRODUCT_NAME "WFS Controller") # etc.
And for Linux this works just fine; I can switch between PlatformIO and JUCE configurations in CLion
On OSX (10.13 I’m afraid, for reasons of ancient hardware), CMake fails to find various system frameworks, e.g.:
CMake Error at /Users/tar/.local/share/JUCE/lib/cmake/JUCE-6.1.6/JUCEModuleSupport.cmake:281 (find_library): Could not find juce_found_Accelerate using the following names: Accelerate Call Stack (most recent call first): /Users/tar/.local/share/JUCE/lib/cmake/JUCE-6.1.6/JUCEModuleSupport.cmake:537 (_juce_link_frameworks) /Users/tar/.local/share/JUCE/lib/cmake/JUCE-6.1.6/JUCEConfig.cmake:111 (juce_add_module) wfs-controller/CMakeLists.txt:27 (find_package)
list(APPEND CMAKE_PREFIX_PATH /System/Library/Frameworks) for
CMAKE_SYSTEM_NAME STREQUAL "Darwin" kind of gets around that, though CMake doesn’t seem completely happy, e.g.:
"/System/Library/Frameworks/Accelerate.framework". Targets may link only to libraries. CMake is dropping the item.
Still, it completes configuration and I can attempt a build, but then the compiler chokes on a mouthful of Objective-C, e.g.:
In file included from ~/.local/share/JUCE/include/JUCE-6.1.6/modules/juce_events/juce_events.cpp:42: In file included from ~/.local/share/JUCE/include/JUCE-6.1.6/modules/juce_events/juce_events.h:52: In file included from ~/.local/share/JUCE/include/JUCE-6.1.6/modules/juce_core/juce_core.h:197: In file included from ~/.local/share/JUCE/include/JUCE-6.1.6/modules/juce_core/native/juce_BasicNativeHeaders.h:45: In file included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12: In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8: /System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:503:1: error: expected unqualified-id @class NSString, Protocol; ^
(NB I’m using JUCE 6.1.6 because I’m stuck with the 10.13 SDK… if there is in fact a way to switch to JUCE 7 and target 10.13 I’d be keen to hear.)
So my guess is mixing pio and JUCE like this, on Mac at least, means some paths or CMake/compiler flags are missing or invalid where JUCE needs them. If anyone has any suggestions re. getting this to work (as it does on Linux) I’d be very grateful for the assistance.