diff --git a/example/app/CMakeLists.txt b/example/app/CMakeLists.txt index 6353f76..4287b7d 100644 --- a/example/app/CMakeLists.txt +++ b/example/app/CMakeLists.txt @@ -1,3 +1,17 @@ +add_library (juce_modules STATIC) +add_library (focusrite-e2e::juce_modules ALIAS juce_modules) + +target_link_libraries (juce_modules PRIVATE juce::juce_gui_extra) + +# We're linking the modules privately, but we need to export their compile flags +target_compile_definitions ( + juce_modules PUBLIC JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0 + INTERFACE $) + +# We also need to export the include directories for the modules +target_include_directories ( + juce_modules INTERFACE $) + juce_add_gui_app (e2e-example-app VERSION 0.0.0) target_sources ( @@ -12,14 +26,12 @@ target_compile_definitions ( e2e-example-app PRIVATE DONT_SET_USING_JUCE_NAMESPACE=1 - JUCE_WEB_BROWSER=0 - JUCE_USE_CURL=0 JUCE_APPLICATION_NAME_STRING="$" JUCE_APPLICATION_VERSION_STRING="$" ) target_link_libraries ( - e2e-example-app PRIVATE juce::juce_gui_extra + e2e-example-app INTERFACE juce_modules PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) diff --git a/source/cpp/CMakeLists.txt b/source/cpp/CMakeLists.txt index 6470c2b..fe0ad8e 100644 --- a/source/cpp/CMakeLists.txt +++ b/source/cpp/CMakeLists.txt @@ -1,12 +1,4 @@ -add_library ( - focusrite-e2e - include/focusrite/e2e/ClickableComponent.h - include/focusrite/e2e/Command.h - include/focusrite/e2e/CommandHandler.h - include/focusrite/e2e/ComponentSearch.h - include/focusrite/e2e/Event.h - include/focusrite/e2e/Response.h - include/focusrite/e2e/TestCentre.h +add_library (focusrite-e2e STATIC source/Command.cpp source/ComponentSearch.cpp source/Connection.cpp @@ -23,23 +15,7 @@ add_library (focusrite-e2e::focusrite-e2e ALIAS focusrite-e2e) target_include_directories (focusrite-e2e PUBLIC include) -set (JUCE_MODULES juce_core juce_events) - -foreach (JUCE_MODULE ${JUCE_MODULES}) - - if (NOT TARGET ${JUCE_MODULE}) - message(FATAL_ERROR "Missing JUCE module: ${JUCE_MODULE}, enable FOCUSRITE_E2E_FETCH_JUCE to fetch JUCE") - endif() - - get_target_property (MODULE_INCLUDES ${JUCE_MODULE} - INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories (focusrite-e2e PUBLIC ${MODULE_INCLUDES}) -endforeach () - -target_include_directories (focusrite-e2e PRIVATE ${juce_SOURCE_DIR}/modules) - -target_compile_definitions (focusrite-e2e - PRIVATE JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1) +target_link_libraries(focusrite-e2e PUBLIC focusrite-e2e::juce_modules) set_common_target_properties (focusrite-e2e)