1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

CMake: Add option to enable module source groups in IDE projects

This commit is contained in:
reuk 2020-09-02 12:09:43 +01:00
parent 9d5bf9c43c
commit 6b1b4cf7f6
2 changed files with 17 additions and 7 deletions

View file

@ -46,6 +46,16 @@ set_property(GLOBAL PROPERTY JUCE_COPY_PLUGIN_AFTER_BUILD ${JUCE_COPY_PLUGIN_AFT
set(CMAKE_CXX_EXTENSIONS FALSE)
# This option controls whether dummy targets are added to the build which contain all of the source
# files for each JUCE module. If you're planning to use an IDE and want to be able to browse all of
# JUCE's source files, this may be useful. However, 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, otherwise the module
# sources will be added directly to the top level of the project, instead of in a nice 'Modules'
# subfolder.
option(JUCE_ENABLE_MODULE_SOURCE_GROUPS "Show all module sources in IDE projects" OFF)
add_subdirectory(modules)
add_subdirectory(extras/Build)

View file

@ -612,6 +612,13 @@ function(juce_add_module module_path)
if(JUCE_ARG_ALIAS_NAMESPACE)
add_library(${JUCE_ARG_ALIAS_NAMESPACE}::${module_name} ALIAS ${module_name})
endif()
if(JUCE_ENABLE_MODULE_SOURCE_GROUPS)
file(GLOB_RECURSE extra_files LIST_DIRECTORIES FALSE "${module_path}/*")
add_custom_target(${module_name}_sources SOURCES ${extra_files})
set_target_properties(${module_name}_sources PROPERTIES FOLDER Modules)
source_group(TREE "${module_path}" FILES ${extra_files})
endif()
endfunction()
function(juce_add_modules)
@ -1958,13 +1965,6 @@ function(_juce_initialise_target target)
_juce_write_generate_time_info(${target})
_juce_link_optional_libraries(${target})
file(GLOB juce_module_folders RELATIVE "${JUCE_MODULES_DIR}" "${JUCE_MODULES_DIR}/*")
foreach(module_folder IN LISTS juce_module_folders)
file(GLOB_RECURSE juce_module_files "${JUCE_MODULES_DIR}/${module_folder}/*")
source_group(TREE "${JUCE_MODULES_DIR}" PREFIX "Modules" FILES ${juce_module_files})
endforeach()
endfunction()
# ==================================================================================================