From 54f2774d2e5e612b7602e2f779478c06fe8f6fe0 Mon Sep 17 00:00:00 2001
From: Brad Davis <bdavis@saintandreas.org>
Date: Thu, 19 Mar 2015 15:45:11 -0700
Subject: [PATCH] Organize projects into folders for IDEs that support it

---
 CMakeLists.txt                       | 7 +++++++
 cmake/macros/LinkHifiLibraries.cmake | 1 +
 tests/CMakeLists.txt                 | 1 +
 tools/CMakeLists.txt                 | 4 ++++
 4 files changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1555321c32..296a566fa4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,9 @@ if (POLICY CMP0042)
   cmake_policy(SET CMP0042 OLD)
 endif ()
 
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
+
 project(hifi)
 add_definitions(-DGLM_FORCE_RADIANS)
 
@@ -173,9 +176,13 @@ endif ()
 # add subdirectories for all targets
 if (NOT ANDROID)
   add_subdirectory(assignment-client)
+  set_target_properties(assignment-client PROPERTIES FOLDER "Apps")
   add_subdirectory(domain-server)
+  set_target_properties(domain-server PROPERTIES FOLDER "Apps")
   add_subdirectory(ice-server)
+  set_target_properties(ice-server PROPERTIES FOLDER "Apps")
   add_subdirectory(interface)
+  set_target_properties(interface PROPERTIES FOLDER "Apps")
   add_subdirectory(tests)
   add_subdirectory(tools)
 endif ()
diff --git a/cmake/macros/LinkHifiLibraries.cmake b/cmake/macros/LinkHifiLibraries.cmake
index ed68103c0c..ef7467e170 100644
--- a/cmake/macros/LinkHifiLibraries.cmake
+++ b/cmake/macros/LinkHifiLibraries.cmake
@@ -16,6 +16,7 @@ macro(LINK_HIFI_LIBRARIES)
   foreach(HIFI_LIBRARY ${LIBRARIES_TO_LINK})    
     if (NOT TARGET ${HIFI_LIBRARY})
       add_subdirectory("${RELATIVE_LIBRARY_DIR_PATH}/${HIFI_LIBRARY}" "${RELATIVE_LIBRARY_DIR_PATH}/${HIFI_LIBRARY}")
+      set_target_properties(${HIFI_LIBRARY} PROPERTIES FOLDER "Libraries")
     endif ()
   
     include_directories("${HIFI_LIBRARY_DIR}/${HIFI_LIBRARY}/src")
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 862792d8ac..b6b57ca530 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -4,5 +4,6 @@ list(REMOVE_ITEM TEST_SUBDIRS "CMakeFiles")
 foreach(DIR ${TEST_SUBDIRS})
     if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}")
         add_subdirectory(${DIR})
+        set_target_properties("${DIR}-tests" PROPERTIES FOLDER "Tests")
     endif()
 endforeach()
\ No newline at end of file
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 08fe8fd7f3..5c7c306a62 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,8 +1,12 @@
 # add the tool directories
 add_subdirectory(mtc)
+set_target_properties(mtc PROPERTIES FOLDER "Tools")
 add_subdirectory(scribe)
+set_target_properties(scribe PROPERTIES FOLDER "Tools")
+
 
 find_package(VHACD)
 if(VHACD_FOUND)
 add_subdirectory(vhacd)
+set_target_properties(vhacd PROPERTIES FOLDER "Tools")
 endif()