Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Create an IDE folder structure #2791

Merged
merged 2 commits into from
Oct 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(MSVC)
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()