Commit 94f10559 authored by jcfr's avatar jcfr

ENH: Improve build targets organization in IDE that support folders

This commit set the FOLDER property on all targets to group them
into meaningful "units". This will make development easier ensuring
it is possible to quickly re-build and open the source files associated
with the targets of either a given module, the core libraries or even
the Slicer application.

Currently the grouping is:
* App-SlicerApp
* CMakePredefinedTargets
* Core-Base
* Core-Libs
 * FreeSurfer
 * ITKFactoryRegistration
 * [...]
* Module-<NameOfModule>
* [...]

If for some reason, the folder organization needs to be disabled. Slicer
could be configured with Slicer_USE_FOLDERS set to OFF.

Projects updated in this commit:
* CTK
* SlicerExecutionModel
* OtsuThresholdImageFilter

Notes:

 (1) some of the targets (EMSegment, BRAINSTools, MultiVolume, ...)
are still associated to the root and not yet categorized.

 (2) ideally few more  macros/functions should be introduced: one to
easily configure subject hierarchy plugin, and one to easily configure
tests associated with a CLI.


CTK changes:

// -------------
commit commontk/CTK@ac1370e
Author: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
Date:   Wed Feb 4 14:47:09 2015 -0500

    Add FOLDER parameter to ctkMacroBuildQtPlugin

    If specified, the target(s) associated with designer, icon engine and
    style plugins will be added into the specified folder when the project is
    configured for an IDE supporting it.

    For more details, see http://www.cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:FOLDER
// -------------


SlicerExecutionModel changes:

// -------------
commit Slicer/SlicerExecutionModel@0b780eb
Author: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
Date:   Wed Feb 4 18:06:25 2015 -0500

    ENH: SEMMacroBuildCLI - Add possibility to associate FOLDER with CLI targets

    In project building a lot of modules (i.e Slicer), whenever possible, it
    is better to keep the huge list of targets organized. To help with this,
    CMake allows to set a FOLDER target property.

    See http://www.cmake.org/cmake/help/v2.8.3/cmake.html#prop_tgt:FOLDER

    This commit extends the SEMMacroBuildCLI API to accept an optional FOLDER
    parameter. If not set, the folder name will default to:

      <SlicerExecutionModel_DEFAULT_CLI_TARGETS_FOLDER_PREFIX><MODULE_NAME>

    By default the prefix is set to an empty string and the folder will be
    named after the module name.

    There are two ways to specify a default prefix value:

     (1) Set the variable SlicerExecutionModel_DEFAULT_CLI_TARGETS_FOLDER_PREFIX
    in the current scope before calling 'SEMMacroBuildCLI'

     (2) Configure the SlicerExecutionModel project with the option
    SlicerExecutionModel_DEFAULT_CLI_TARGETS_FOLDER_PREFIX

    Note that:
     - FOLDER support has been introduced in CMake >= 2.8.3
    and
     - it can optionally be enabled in a project by setting the global
    property named USE_FOLDERS.

    See http://www.cmake.org/cmake/help/v2.8.3/cmake.html#prop_global:USE_FOLDERS

    Finally, to associate CLI test expected to be in the same "FOLDER",
    a variable named <MODULE_NAME>_TARGETS_FOLDER is conveniently set in the
    current scope each time the macro SEMMacroBuildCLI is called.

commit Slicer/SlicerExecutionModel@e84d231
Author: Matt McCormick <matt.mccormick@kitware.com>
Date:   Thu Aug 7 11:09:39 2014 -0400

    BUG: Fix ModuleDescriptionParser test data dir.

    Fixes Parser1Test{1,2}.

    Simplify by consolidation of variables.
// -------------


OtsuThresholdImageFilter changes:

// -------------
commit :Slicer/Slicer-OtsuThresholdImageFilter@5efe412
Author: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
Date:   Wed Feb 4 18:08:28 2015 -0500

    Associate folder with test targets.
    [...]
// -------------

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23961 3bd1e089-480b-0410-8dfb-8563597acbee
parent 47ee30af
......@@ -30,6 +30,11 @@ if(WIN32)
set(Slicer_HAS_CONSOLE_IO_SUPPORT ${Slicer_BUILD_WIN32_CONSOLE})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
set(${PROJECT_NAME}_FOLDER "App-${PROJECT_NAME}")
# --------------------------------------------------------------------------
# Sources
# --------------------------------------------------------------------------
......@@ -236,6 +241,14 @@ target_link_libraries(${PROJECT_NAME}${SlicerApp_EXE_SUFFIX}
${KIT_LIBRARY_NAME}
)
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${KIT_LIBRARY_NAME} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
set_target_properties(${PROJECT_NAME}${SlicerApp_EXE_SUFFIX} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
#-----------------------------------------------------------------------------
# Configure
# --------------------------------------------------------------------------
......@@ -354,6 +367,11 @@ if(${PROJECT_NAME} STREQUAL ${Slicer_MAIN_PROJECT})
ADDITIONAL_PATH_ENVVARS_PREFIX SLICER_
)
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${SlicerApp_APPLICATION_NAME}ConfigureLauncher PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
if(WIN32)
set(SlicerApp_APPLICATION_ICON ${CMAKE_CURRENT_SOURCE_DIR}/Resources/${SlicerApp_APPLICATION_NAME}.ico)
message(STATUS "Setting SlicerApp_APPLICATION_ICON to '${SlicerApp_APPLICATION_ICON}'")
......@@ -387,6 +405,11 @@ if(${PROJECT_NAME} STREQUAL ${Slicer_MAIN_PROJECT})
DEPENDS
${Slicer_BINARY_DIR}/CMakeFiles/${SlicerApp_APPLICATION_NAME}W${CMAKE_EXECUTABLE_SUFFIX}
)
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${SlicerApp_APPLICATION_NAME}UpdateLauncherWIcon PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
install(
PROGRAMS "${Slicer_BINARY_DIR}/CMakeFiles/${SlicerApp_APPLICATION_NAME}W${CMAKE_EXECUTABLE_SUFFIX}"
DESTINATION "."
......@@ -417,6 +440,11 @@ if(${PROJECT_NAME} STREQUAL ${Slicer_MAIN_PROJECT})
IDI_ICON1 ${SlicerApp_APPLICATION_ICON}
)
add_dependencies(${SlicerApp_APPLICATION_NAME}UpdateLauncherIcon ${SlicerApp_APPLICATION_NAME}ConfigureLauncher)
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${SlicerApp_APPLICATION_NAME}UpdateLauncherIcon PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
endif()
endif()
......
......@@ -41,6 +41,7 @@ endif()
add_executable(${KIT}CxxTests ${Tests})
target_link_libraries(${KIT}CxxTests ${target_libraries})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER ${PROJECT_NAME}_FOLDER)
#
# Add Tests
......
......@@ -105,6 +105,7 @@ if(SlicerBaseCLI_SRCS)
add_library(${lib_name} ${SlicerBaseCLI_SRCS})
target_link_libraries(${lib_name} ${SlicerBaseCLI_LIBS})
set_target_properties(${lib_name} PROPERTIES LABELS ${lib_name})
set_target_properties(${lib_name} PROPERTIES FOLDER "Core-Base")
# Apply user-defined properties to the library target.
if(Slicer_LIBRARY_PROPERTIES)
......
......@@ -189,6 +189,7 @@ endif()
target_link_libraries(${lib_name} ${libs})
set_target_properties(${lib_name} PROPERTIES LABELS ${lib_name})
set_target_properties(${lib_name} PROPERTIES FOLDER "Core-Base")
# Apply user-defined properties to the library target.
if(Slicer_LIBRARY_PROPERTIES)
......@@ -224,6 +225,9 @@ if(VTK_WRAP_PYTHON)
)
# Export target
set_property(GLOBAL APPEND PROPERTY Slicer_TARGETS ${lib_name}Python ${lib_name}PythonD)
set_target_properties(${lib_name}Python PROPERTIES FOLDER "Core-Base")
set_target_properties(${lib_name}PythonD PROPERTIES FOLDER "Core-Base")
endif()
# --------------------------------------------------------------------------
......
......@@ -15,6 +15,7 @@ create_test_sourcelist(Tests ${KIT}CxxTests.cxx
add_executable(${KIT}CxxTests ${Tests})
target_link_libraries(${KIT}CxxTests ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES LABELS ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER "Core-Base")
simple_test( vtkArchiveTest1 ${CMAKE_CURRENT_SOURCE_DIR}/vol.zip)
simple_test( vtkDataIOManagerLogicTest1 )
......
......@@ -134,6 +134,9 @@ if(VTK_WRAP_PYTHON)
KIT_PYTHON_LIBRARIES SlicerBaseLogicPythonD
)
set_property(GLOBAL APPEND PROPERTY Slicer_TARGETS ${PROJECT_NAME}Python ${PROJECT_NAME}PythonD)
# Folder
set_target_properties(${PROJECT_NAME}Python PROPERTIES FOLDER "Core-Base")
set_target_properties(${PROJECT_NAME}PythonD PROPERTIES FOLDER "Core-Base")
endif()
# --------------------------------------------------------------------------
......
......@@ -33,6 +33,7 @@ set(${KIT}_TARGET_LIBRARIES
ctkMacroBuildQtDesignerPlugin(
NAME ${PROJECT_NAME}
EXPORT_DIRECTIVE ${${KIT}_EXPORT}
FOLDER "Core-Base"
SRCS ${${KIT}_SRCS}
MOC_SRCS ${${KIT}_MOC_SRCS}
TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES}
......
......@@ -13,6 +13,7 @@ include(${SlicerExecutionModel_USE_FILE})
#-----------------------------------------------------------------------------
SEMMacroBuildCLI(
NAME CLIModule4Test
FOLDER "Core-Base"
LOGO_HEADER ${Slicer_SOURCE_DIR}/Resources/ITKLogo.h
NO_INSTALL
)
......@@ -29,6 +30,7 @@ create_test_sourcelist(Tests ${KIT}CxxTests.cxx
add_executable(${KIT}CxxTests ${Tests})
target_link_libraries(${KIT}CxxTests ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES LABELS ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER "Core-Base")
#
# Add Tests
......
......@@ -55,6 +55,7 @@ if(BUILD_TESTING)
add_executable(${KIT}CxxTests ${Tests})
target_link_libraries(${KIT}CxxTests ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES LABELS ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER "Core-Base")
#
# Add Tests
......
......@@ -321,6 +321,7 @@ set(CTK_LIBRARIES CTKWidgets)
ctkMacroBuildQtIconEnginesPlugin(
NAME qSlicerIconEnginePlugin
EXPORT_DIRECTIVE "Q_SLICER_BASE_QTGUI_ICON_ENGINE_EXPORT"
FOLDER "Core-Base"
SRCS qSlicerIconEnginePlugin.cxx qSlicerIconEnginePlugin.h
MOC_SRCS qSlicerIconEnginePlugin.h
TARGET_LIBRARIES ${QT_LIBRARIES} ${CTK_LIBRARIES}
......
......@@ -48,6 +48,7 @@ endif()
ctkMacroBuildQtDesignerPlugin(
NAME ${PROJECT_NAME}
EXPORT_DIRECTIVE ${${KIT}_EXPORT}
FOLDER "Core-Base"
SRCS ${${KIT}_SRCS}
MOC_SRCS ${${KIT}_MOC_SRCS}
TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES}
......
......@@ -25,6 +25,7 @@ set(${KIT}_TARGET_LIBRARIES
ctkMacroBuildQtStylesPlugin(
NAME ${PROJECT_NAME}
EXPORT_DIRECTIVE ${${KIT}_EXPORT}
FOLDER "Core-Base"
SRCS ${${KIT}_SRCS}
MOC_SRCS ${${KIT}_MOC_SRCS}
TARGET_LIBRARIES ${${KIT}_TARGET_LIBRARIES}
......
......@@ -50,6 +50,7 @@ if(BUILD_TESTING)
add_executable(${KIT}CxxTests ${Tests})
target_link_libraries(${KIT}CxxTests ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES LABELS ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER "Core-Base")
#
# Add Tests
......
......@@ -213,6 +213,9 @@ macro(SlicerMacroBuildBaseQtLibrary)
${SLICERQTBASELIB_TARGET_LIBRARIES}
)
# Folder
set_target_properties(${lib_name} PROPERTIES FOLDER "Core-Base")
#-----------------------------------------------------------------------------
# Install library
#-----------------------------------------------------------------------------
......@@ -246,6 +249,7 @@ macro(SlicerMacroBuildBaseQtLibrary)
INSTALL_BIN_DIR ${Slicer_INSTALL_BIN_DIR}
INSTALL_LIB_DIR ${Slicer_INSTALL_LIB_DIR}
)
set_target_properties(${lib_name}PythonQt PROPERTIES FOLDER "Core-Base")
endif()
# --------------------------------------------------------------------------
......
......@@ -30,6 +30,7 @@ macro(SlicerMacroBuildModuleLogic)
set(oneValueArgs
NAME
EXPORT_DIRECTIVE
FOLDER
)
set(multiValueArgs
SRCS
......@@ -76,6 +77,10 @@ macro(SlicerMacroBuildModuleLogic)
)
endif()
if(NOT DEFINED MODULELOGIC_FOLDER AND DEFINED MODULE_NAME)
set(MODULELOGIC_FOLDER "Module-${MODULE_NAME}")
endif()
set(MODULELOGIC_NO_INSTALL_OPTION)
if(MODULELOGIC_NO_INSTALL)
set(MODULELOGIC_NO_INSTALL_OPTION "NO_INSTALL")
......@@ -84,6 +89,7 @@ macro(SlicerMacroBuildModuleLogic)
SlicerMacroBuildModuleVTKLibrary(
NAME ${MODULELOGIC_NAME}
EXPORT_DIRECTIVE ${MODULELOGIC_EXPORT_DIRECTIVE}
FOLDER ${MODULELOGIC_FOLDER}
SRCS ${MODULELOGIC_SRCS}
INCLUDE_DIRECTORIES ${MODULELOGIC_INCLUDE_DIRECTORIES}
TARGET_LIBRARIES ${MODULELOGIC_TARGET_LIBRARIES}
......@@ -130,6 +136,11 @@ macro(SlicerMacroBuildModuleLogic)
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${Slicer_QTLOADABLEMODULES_LIB_DIR}"
)
if(NOT "${MODULELOGIC_FOLDER}" STREQUAL "")
set_target_properties(${MODULELOGIC_NAME}Python PROPERTIES FOLDER ${MODULELOGIC_FOLDER})
set_target_properties(${MODULELOGIC_NAME}PythonD PROPERTIES FOLDER ${MODULELOGIC_FOLDER})
endif()
# Export target
set_property(GLOBAL APPEND PROPERTY Slicer_TARGETS ${MODULELOGIC_NAME}Python ${MODULELOGIC_NAME}PythonD)
endif()
......
......@@ -30,6 +30,7 @@ macro(SlicerMacroBuildModuleMRML)
set(oneValueArgs
NAME
EXPORT_DIRECTIVE
FOLDER
)
set(multiValueArgs
SRCS
......@@ -52,6 +53,10 @@ macro(SlicerMacroBuildModuleMRML)
${Slicer_ModuleMRML_INCLUDE_DIRS}
)
if(NOT DEFINED MODULEMRML_FOLDER AND DEFINED MODULE_NAME)
set(MODULEMRML_FOLDER "Module-${MODULE_NAME}")
endif()
set(MODULEMRML_NO_INSTALL_OPTION)
if(MODULEMRML_NO_INSTALL)
set(MODULEMRML_NO_INSTALL_OPTION "NO_INSTALL")
......@@ -60,6 +65,7 @@ macro(SlicerMacroBuildModuleMRML)
SlicerMacroBuildModuleVTKLibrary(
NAME ${MODULEMRML_NAME}
EXPORT_DIRECTIVE ${MODULEMRML_EXPORT_DIRECTIVE}
FOLDER ${MODULEMRML_FOLDER}
SRCS ${MODULEMRML_SRCS}
INCLUDE_DIRECTORIES ${MODULEMRML_INCLUDE_DIRECTORIES}
TARGET_LIBRARIES ${MODULEMRML_TARGET_LIBRARIES}
......@@ -105,6 +111,11 @@ macro(SlicerMacroBuildModuleMRML)
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${Slicer_QTLOADABLEMODULES_LIB_DIR}"
)
if(NOT "${MODULEMRML_FOLDER}" STREQUAL "")
set_target_properties(${MODULEMRML_NAME}Python PROPERTIES FOLDER ${MODULEMRML_FOLDER})
set_target_properties(${MODULEMRML_NAME}PythonD PROPERTIES FOLDER ${MODULEMRML_FOLDER})
endif()
# Export target
set_property(GLOBAL APPEND PROPERTY Slicer_TARGETS ${MODULEMRML_NAME}Python ${MODULEMRML_NAME}PythonD)
endif()
......
......@@ -30,6 +30,7 @@ macro(SlicerMacroBuildModuleQtLibrary)
set(oneValueArgs
NAME
EXPORT_DIRECTIVE
FOLDER
)
set(multiValueArgs
SRCS
......@@ -151,6 +152,10 @@ macro(SlicerMacroBuildModuleQtLibrary)
)
set_target_properties(${lib_name} PROPERTIES LABELS ${lib_name})
if(NOT "${MODULEQTLIBRARY_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${MODULEQTLIBRARY_FOLDER})
endif()
target_link_libraries(${lib_name}
${MODULEQTLIBRARY_TARGET_LIBRARIES}
)
......@@ -217,6 +222,9 @@ macro(SlicerMacroBuildModuleQtLibrary)
INSTALL_LIB_DIR ${Slicer_INSTALL_QTLOADABLEMODULES_LIB_DIR}
${MODULEQTLIBRARY_NO_INSTALL_OPTION}
)
if(NOT "${MODULEQTLIBRARY_FOLDER}" STREQUAL "")
set_target_properties(${lib_name}PythonQt PROPERTIES FOLDER ${MODULEQTLIBRARY_FOLDER})
endif()
endif()
endmacro()
......@@ -30,6 +30,7 @@ macro(SlicerMacroBuildModuleVTKLibrary)
set(oneValueArgs
NAME
EXPORT_DIRECTIVE
FOLDER
)
set(multiValueArgs
SRCS
......@@ -120,6 +121,10 @@ macro(SlicerMacroBuildModuleVTKLibrary)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
if(NOT "${MODULEVTKLIBRARY_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${MODULEVTKLIBRARY_FOLDER})
endif()
# --------------------------------------------------------------------------
# Install library
# --------------------------------------------------------------------------
......
......@@ -30,6 +30,7 @@ macro(SlicerMacroBuildModuleWidgets)
set(oneValueArgs
NAME
EXPORT_DIRECTIVE
FOLDER
)
set(multiValueArgs
SRCS
......@@ -62,6 +63,13 @@ macro(SlicerMacroBuildModuleWidgets)
${Slicer_GUI_LIBRARY}
)
if(NOT DEFINED MODULEWIDGETS_FOLDER AND DEFINED MODULE_NAME)
set(MODULEWIDGETS_FOLDER "Module-${MODULE_NAME}")
endif()
if(NOT "${MODULEWIDGETS_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${MODULEWIDGETS_FOLDER})
endif()
set(MODULEWIDGETS_WRAP_PYTHONQT_OPTION)
if(MODULEWIDGETS_WRAP_PYTHONQT)
set(MODULEWIDGETS_WRAP_PYTHONQT_OPTION "WRAP_PYTHONQT")
......@@ -74,6 +82,7 @@ macro(SlicerMacroBuildModuleWidgets)
SlicerMacroBuildModuleQtLibrary(
NAME ${MODULEWIDGETS_NAME}
EXPORT_DIRECTIVE ${MODULEWIDGETS_EXPORT_DIRECTIVE}
FOLDER ${MODULEWIDGETS_FOLDER}
INCLUDE_DIRECTORIES ${MODULEWIDGETS_INCLUDE_DIRECTORIES}
SRCS ${MODULEWIDGETS_SRCS}
MOC_SRCS ${MODULEWIDGETS_MOC_SRCS}
......
......@@ -194,6 +194,14 @@ macro(slicerMacroBuildLoadableModule)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# Folder
if(NOT DEFINED LOADABLEMODULE_FOLDER AND DEFINED MODULE_NAME)
set(LOADABLEMODULE_FOLDER "Module-${MODULE_NAME}")
endif()
if(NOT "${LOADABLEMODULE_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${LOADABLEMODULE_FOLDER})
endif()
set_property(GLOBAL APPEND PROPERTY SLICER_MODULE_TARGETS ${lib_name})
# --------------------------------------------------------------------------
......@@ -252,6 +260,9 @@ macro(slicerMacroBuildLoadableModule)
add_executable(${KIT}GenericCxxTests ${Tests})
set_target_properties(${KIT}GenericCxxTests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${Slicer_BIN_DIR})
target_link_libraries(${KIT}GenericCxxTests ${KIT})
if(NOT "${LOADABLEMODULE_FOLDER}" STREQUAL "")
set_target_properties(${KIT}GenericCxxTests PROPERTIES FOLDER ${LOADABLEMODULE_FOLDER})
endif()
foreach(testname ${KIT_GENERIC_TEST_NAMES})
add_test(NAME ${testname}
......
......@@ -25,6 +25,7 @@ macro(SlicerMacroConfigureModuleCxxTestDriver)
set(oneValueArgs
NAME
TESTS_TO_RUN_VAR
FOLDER
)
set(multiValueArgs
SOURCES
......@@ -93,6 +94,13 @@ macro(SlicerMacroConfigureModuleCxxTestDriver)
${SLICER_TEST_DRIVER_NAME}
${SLICER_TEST_DRIVER_TARGET_LIBRARIES}
)
if(NOT DEFINED SLICER_TEST_DRIVER_FOLDER AND DEFINED MODULE_NAME)
set(SLICER_TEST_DRIVER_FOLDER "Module-${MODULE_NAME}")
endif()
if(NOT "${SLICER_TEST_DRIVER_FOLDER}" STREQUAL "")
set_target_properties(${SLICER_TEST_DRIVER_NAME}CxxTests
PROPERTIES FOLDER ${SLICER_TEST_DRIVER_FOLDER})
endif()
endif()
endmacro()
......@@ -236,6 +236,10 @@ mark_as_superbuild(Slicer_UPDATE_TRANSLATION)
set(Slicer_FORCED_WC_REVISION "" CACHE STRING "Overwrite value of auto-discovered Slicer_WC_REVISION")
mark_as_advanced(Slicer_FORCED_WC_REVISION)
option(Slicer_USE_FOLDERS "Organize build targets into folders" ON)
mark_as_superbuild(Slicer_USE_FOLDERS)
mark_as_advanced(Slicer_USE_FOLDERS)
#-----------------------------------------------------------------------------
# External projects related options
#-----------------------------------------------------------------------------
......@@ -606,6 +610,11 @@ foreach(dep QT ${Slicer_DEPENDENCIES})
endif()
endforeach()
#-----------------------------------------------------------------------------
# Folders
#-----------------------------------------------------------------------------
set_property(GLOBAL PROPERTY USE_FOLDERS ${Slicer_USE_FOLDERS})
#-----------------------------------------------------------------------------
# Clear SlicerTargets.cmake
#-----------------------------------------------------------------------------
......
......@@ -76,6 +76,7 @@ foreach(dir ${dirs})
set(${dir_noslash}_INSTALL_SHARE_DIR ${Slicer_INSTALL_ROOT}share/${dir_noslash})
set(${dir_noslash}_INSTALL_NO_DEVELOPMENT ${Slicer_INSTALL_NO_DEVELOPMENT})
set(${dir_noslash}_EXPORT_FILE ${Slicer_BINARY_DIR}/SlicerTargets.cmake)
set(${dir_noslash}_FOLDER Core-Libs/${dir_noslash})
add_subdirectory(${dir})
endforeach()
......
......@@ -113,6 +113,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -152,6 +162,11 @@ if(VTK_WRAP_PYTHON)
)
# Export target
export(TARGETS ${lib_name}Python ${lib_name}PythonD APPEND FILE ${${PROJECT_NAME}_EXPORT_FILE})
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name}Python PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
set_target_properties(${lib_name}PythonD PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
endif()
# --------------------------------------------------------------------------
......
......@@ -99,6 +99,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......
......@@ -87,6 +87,16 @@ add_library(${lib_name} ${srcs})
set(libs ${ITK_LIBRARIES})
target_link_libraries(${lib_name} ${libs})
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -143,6 +153,11 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(MGHIOPlugin PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Install library - MGHIO and MGHIOPlugin are installed in different locations
# --------------------------------------------------------------------------
......
......@@ -102,6 +102,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -141,6 +151,11 @@ if(VTK_WRAP_PYTHON)
)
# Export target
export(TARGETS ${lib_name}Python ${lib_name}PythonD APPEND FILE ${${PROJECT_NAME}_EXPORT_FILE})
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name}Python PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
set_target_properties(${lib_name}PythonD PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
endif()
# --------------------------------------------------------------------------
......
......@@ -273,6 +273,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -309,6 +319,11 @@ if(VTK_WRAP_PYTHON)
)
# Export target
export(TARGETS ${lib_name}Python ${lib_name}PythonD APPEND FILE ${${PROJECT_NAME}_EXPORT_FILE})
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name}Python PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
set_target_properties(${lib_name}PythonD PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
endif()
# --------------------------------------------------------------------------
......
......@@ -104,6 +104,8 @@ create_test_sourcelist(Tests ${KIT}CxxTests.cxx
add_executable(${KIT}CxxTests ${Tests} vtkMRMLSceneEventRecorder.cxx)
target_link_libraries(${KIT}CxxTests ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
#-----------------------------------------------------------------------------
set(TEMP "${CMAKE_BINARY_DIR}/Testing/Temporary")
......
......@@ -185,6 +185,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -224,6 +234,11 @@ if(MRMLDisplayableManager_USE_PYTHON)
)
# Export target
export(TARGETS ${lib_name}Python ${lib_name}PythonD APPEND FILE ${${PROJECT_NAME}_EXPORT_FILE})
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name}Python PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
set_target_properties(${lib_name}PythonD PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
add_subdirectory(Python)
endif()
......
......@@ -40,6 +40,8 @@ add_executable(${KIT}CxxTests
${DisplayableManagerInstantiatorTest_SRCS})
target_link_libraries(${KIT}CxxTests ${KIT})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
#
# Add all the tests
#
......
......@@ -98,6 +98,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -146,6 +156,11 @@ set_target_properties(MRMLIDIOPlugin PROPERTIES
)
target_link_libraries(MRMLIDIOPlugin ${lib_name})
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(MRMLIDIOPlugin PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Install library - MRMLIDIO and MRMLIDOPlugin are installed in different locations
# --------------------------------------------------------------------------
......
......@@ -131,6 +131,16 @@ if(Slicer_LIBRARY_PROPERTIES)
set_target_properties(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES})
endif()
# --------------------------------------------------------------------------
# Folder
# --------------------------------------------------------------------------
if(NOT DEFINED ${PROJECT_NAME}_FOLDER)
set(${PROJECT_NAME}_FOLDER ${PROJECT_NAME})
endif()
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name} PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
# --------------------------------------------------------------------------
# Export target
# --------------------------------------------------------------------------
......@@ -170,6 +180,11 @@ if(VTK_WRAP_PYTHON)
)
# Export target
export(TARGETS ${lib_name}Python ${lib_name}PythonD APPEND FILE ${${PROJECT_NAME}_EXPORT_FILE})
# Folder
if(NOT "${${PROJECT_NAME}_FOLDER}" STREQUAL "")
set_target_properties(${lib_name}Python PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
set_target_properties(${lib_name}PythonD PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})
endif()
endif()
# --------------------------------------------------------------------------
......
......@@ -35,6 +35,8 @@ create_test_sourcelist(Tests ${KIT}CxxTests.cxx
add_executable(${KIT}CxxTests ${Tests})
target_link_libraries(${KIT}CxxTests ${KIT} ${ITK_LIBRARIES})
set_target_properties(${KIT}CxxTests PROPERTIES FOLDER ${${PROJECT_NAME}_FOLDER})