Skip to content

Commit

Permalink
ENH: Create an IDE folder structure (#2791)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-bray authored Oct 11, 2021
1 parent fb64eb2 commit 569f965
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -681,3 +681,25 @@ mark_as_advanced(FORCE
Module_TwoProjectionRegistration
Module_Ultrasound
Module_VariationalRegistration)

# Create an IDE folder structure similar to our source structure
if("${CMAKE_GENERATOR}" MATCHES "Xcode|Visual Studio|KDevelop")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
function(itk_organize_targets dir folder)
itk_get_all_targets_recursive(targets ${dir})
foreach(t ${targets})
get_target_property(f ${t} SOURCE_DIR)
string(REPLACE ${dir} "" f ${f})
set_target_properties (${t} PROPERTIES FOLDER "${folder}/${f}")
endforeach()
endfunction()
macro(itk_get_all_targets_recursive targets dir)
get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
foreach(subdir ${subdirectories})
itk_get_all_targets_recursive(${targets} ${subdir})
endforeach()
get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
list(APPEND ${targets} ${current_targets})
endmacro()
itk_organize_targets(${CMAKE_SOURCE_DIR} ITK)
endif()

0 comments on commit 569f965

Please sign in to comment.