From 87cf262b9e49f48ca760f3b34f4d8108fbb4a78f Mon Sep 17 00:00:00 2001
From: Stephen Birarda <commit@birarda.com>
Date: Fri, 8 Aug 2014 09:38:17 -0700
Subject: [PATCH] get to successful cmake after library link macro changes

---
 assignment-client/CMakeLists.txt     | 14 +-----------
 cmake/macros/LinkHifiLibraries.cmake | 34 ++++++++++++++++++++++++++++
 cmake/macros/LinkHifiLibrary.cmake   | 30 ------------------------
 domain-server/CMakeLists.txt         |  4 +---
 interface/CMakeLists.txt             | 16 +------------
 libraries/audio/CMakeLists.txt       | 16 +------------
 libraries/metavoxels/CMakeLists.txt  | 12 +---------
 libraries/octree/CMakeLists.txt      | 12 +---------
 libraries/shared/CMakeLists.txt      | 19 ----------------
 tests/audio/CMakeLists.txt           | 22 +-----------------
 tests/jitter/CMakeLists.txt          | 24 +-------------------
 tests/metavoxels/CMakeLists.txt      | 17 +-------------
 tests/networking/CMakeLists.txt      | 24 +-------------------
 tests/octree/CMakeLists.txt          | 29 +-----------------------
 tests/physics/CMakeLists.txt         | 27 +---------------------
 tests/shared/CMakeLists.txt          | 28 +----------------------
 tools/bitstream2json/CMakeLists.txt  | 25 +-------------------
 tools/json2bitstream/CMakeLists.txt  | 25 +-------------------
 voxel-edit/CMakeLists.txt            | 32 --------------------------
 19 files changed, 49 insertions(+), 361 deletions(-)
 create mode 100644 cmake/macros/LinkHifiLibraries.cmake
 delete mode 100644 cmake/macros/LinkHifiLibrary.cmake

diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt
index 2d7d43227a..628e473853 100644
--- a/assignment-client/CMakeLists.txt
+++ b/assignment-client/CMakeLists.txt
@@ -5,19 +5,7 @@ setup_hifi_project(${TARGET_NAME} TRUE)
 include_glm(${TARGET_NAME})
 
 # link in the shared libraries
-link_hifi_library(shared ${TARGET_NAME})
-link_hifi_library(audio ${TARGET_NAME})
-link_hifi_library(avatars ${TARGET_NAME})
-link_hifi_library(octree ${TARGET_NAME})
-link_hifi_library(voxels ${TARGET_NAME})
-link_hifi_library(fbx ${TARGET_NAME})
-link_hifi_library(particles ${TARGET_NAME})
-link_hifi_library(models ${TARGET_NAME})
-link_hifi_library(metavoxels ${TARGET_NAME})
-link_hifi_library(networking ${TARGET_NAME})
-link_hifi_library(animation ${TARGET_NAME})
-link_hifi_library(script-engine ${TARGET_NAME})
-link_hifi_library(embedded-webserver ${TARGET_NAME})
+link_hifi_libraries(${TARGET_NAME} audio avatars octree voxels fbx particles models metavoxels networking animation script-engine embedded-webserver)
 
 if (UNIX)
   target_link_libraries(${TARGET_NAME} ${DEPENDENCY_LIBRARIES} ${CMAKE_DL_LIBS})
diff --git a/cmake/macros/LinkHifiLibraries.cmake b/cmake/macros/LinkHifiLibraries.cmake
new file mode 100644
index 0000000000..cf7499c763
--- /dev/null
+++ b/cmake/macros/LinkHifiLibraries.cmake
@@ -0,0 +1,34 @@
+# 
+#  LinkHifiLibrary.cmake
+# 
+#  Copyright 2013 High Fidelity, Inc.
+#
+#  Distributed under the Apache License, Version 2.0.
+#  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
+# 
+
+macro(LINK_HIFI_LIBRARIES TARGET LIBRARIES)
+  
+  file(RELATIVE_PATH RELATIVE_LIBRARY_DIR_PATH ${CMAKE_CURRENT_SOURCE_DIR} "${HIFI_LIBRARY_DIR}")
+  
+  foreach(HIFI_LIBRARY ${LIBRARIES})
+    
+    if (NOT TARGET ${HIFI_LIBRARY})
+      add_subdirectory("${RELATIVE_LIBRARY_DIR_PATH}/${HIFI_LIBRARY}" "${RELATIVE_LIBRARY_DIR_PATH}/${HIFI_LIBRARY}")
+    endif ()
+  
+    include_directories("${HIFI_LIBRARY_DIR}/${HIFI_LIBRARY}/src")
+
+    add_dependencies(${TARGET} ${HIFI_LIBRARY})
+  
+    get_target_property(LINKED_TARGET_DEPENDENCY_LIBRARIES ${HIFI_LIBRARY} DEPENDENCY_LIBRARIES)
+  
+    if (LINKED_TARGET_DEPENDENCY_LIBRARIES)
+      target_link_libraries(${TARGET} ${HIFI_LIBRARY} ${LINKED_TARGET_DEPENDENCY_LIBRARIES})
+    else ()
+      target_link_libraries(${TARGET} ${HIFI_LIBRARY})
+    endif ()
+    
+  endforeach()
+  
+endmacro(LINK_HIFI_LIBRARIES _target _libraries)
\ No newline at end of file
diff --git a/cmake/macros/LinkHifiLibrary.cmake b/cmake/macros/LinkHifiLibrary.cmake
deleted file mode 100644
index 95af4c6fd0..0000000000
--- a/cmake/macros/LinkHifiLibrary.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-# 
-#  LinkHifiLibrary.cmake
-# 
-#  Copyright 2013 High Fidelity, Inc.
-#
-#  Distributed under the Apache License, Version 2.0.
-#  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
-# 
-
-macro(LINK_HIFI_LIBRARY LIBRARY TARGET)
-  
-  file(RELATIVE_PATH RELATIVE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR} "${HIFI_LIBRARY_DIR}/${LIBRARY}")
-  
-  if (NOT TARGET ${LIBRARY})
-    add_subdirectory(${RELATIVE_LIBRARY_PATH} ${RELATIVE_LIBRARY_PATH})
-  endif ()
-  
-  include_directories("${HIFI_LIBRARY_DIR}/${LIBRARY}/src")
-
-  add_dependencies(${TARGET} ${LIBRARY})
-  
-  get_target_property(LINKED_TARGET_DEPENDENCY_LIBRARIES ${LIBRARY} DEPENDENCY_LIBRARIES)
-  
-  if (LINKED_TARGET_DEPENDENCY_LIBRARIES)
-    target_link_libraries(${TARGET} ${LIBRARY} ${LINKED_TARGET_DEPENDENCY_LIBRARIES})
-  else ()
-    target_link_libraries(${TARGET} ${LIBRARY})
-  endif ()
-  
-endmacro(LINK_HIFI_LIBRARY _library _target)
\ No newline at end of file
diff --git a/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt
index e98cee7437..ae130af5ed 100644
--- a/domain-server/CMakeLists.txt
+++ b/domain-server/CMakeLists.txt
@@ -12,9 +12,7 @@ add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
                   $<TARGET_FILE_DIR:${TARGET_NAME}>/resources/web)
 
 # link the shared hifi library
-link_hifi_library(networking ${TARGET_NAME})
-link_hifi_library(shared ${TARGET_NAME})
-link_hifi_library(embedded-webserver ${TARGET_NAME})
+link_hifi_libraries(${TARGET_NAME} embedded-webserver networking shared)
 
 IF (WIN32)
   target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt
index f30fcc68ff..ed280846fe 100644
--- a/interface/CMakeLists.txt
+++ b/interface/CMakeLists.txt
@@ -97,22 +97,8 @@ endif()
 # create the executable, make it a bundle on OS X
 add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
 
-# link in the hifi shared library
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-
 # link required hifi libraries
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(octree ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(voxels ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(fbx ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(metavoxels ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(particles ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(models ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(avatars ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(audio ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(animation ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(script-engine ${TARGET_NAME} "${ROOT_DIR}")
+link_hifi_libraries(${TARGET_NAME} shared octree voxels fbx metavoxels networking particles models avatars audio animation script-engine)
 
 # find any optional and required libraries
 find_package(Faceplus)
diff --git a/libraries/audio/CMakeLists.txt b/libraries/audio/CMakeLists.txt
index ace5f9292c..73d15f0b73 100644
--- a/libraries/audio/CMakeLists.txt
+++ b/libraries/audio/CMakeLists.txt
@@ -1,24 +1,10 @@
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
 set(TARGET_NAME audio)
 
-find_package(Qt5 COMPONENTS Script)
-include_directories(SYSTEM "${Qt5Script_INCLUDE_DIRS}")
-
-# set up the external glm library
-include(${MACRO_DIR}/SetupHifiLibrary.cmake)
 setup_hifi_library(${TARGET_NAME})
 
-include(${MACRO_DIR}/IncludeGLM.cmake)
 include_glm(${TARGET_NAME} "${ROOT_DIR}")
 
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
+link_hifi_libraries(${TARGET_NAME} networking shared)
 
 find_package(Qt5 COMPONENTS Network)
 
diff --git a/libraries/metavoxels/CMakeLists.txt b/libraries/metavoxels/CMakeLists.txt
index 799a549a3b..88b74194ac 100644
--- a/libraries/metavoxels/CMakeLists.txt
+++ b/libraries/metavoxels/CMakeLists.txt
@@ -1,22 +1,12 @@
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
 set(TARGET_NAME metavoxels)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
 auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
 
-include(${MACRO_DIR}/SetupHifiLibrary.cmake)
 setup_hifi_library(${TARGET_NAME} "${AUTOMTC_SRC}")
 
 # link in the networking library
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
+link_hifi_libraries(${TARGET_NAME} networking)
 
-include(${MACRO_DIR}/IncludeGLM.cmake)
 include_glm(${TARGET_NAME} "${ROOT_DIR}")
 
 find_package(Qt5 COMPONENTS Network Script Widgets)
diff --git a/libraries/octree/CMakeLists.txt b/libraries/octree/CMakeLists.txt
index d0beade108..efdb1bc70a 100644
--- a/libraries/octree/CMakeLists.txt
+++ b/libraries/octree/CMakeLists.txt
@@ -1,20 +1,10 @@
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
 set(TARGET_NAME octree)
 
-include(${MACRO_DIR}/SetupHifiLibrary.cmake)
 setup_hifi_library(${TARGET_NAME})
 
-include(${MACRO_DIR}/IncludeGLM.cmake)
 include_glm(${TARGET_NAME} "${ROOT_DIR}")
 
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
+link_hifi_libraries(${TARGET_NAME} shared networking)
 
 # link ZLIB
 find_package(ZLIB)
diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt
index 6badb10f8e..b8e34739b8 100644
--- a/libraries/shared/CMakeLists.txt
+++ b/libraries/shared/CMakeLists.txt
@@ -1,25 +1,6 @@
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
 set(TARGET_NAME shared)
-project(${TARGET_NAME})
-
-include(${MACRO_DIR}/SetupHifiLibrary.cmake)
 setup_hifi_library(${TARGET_NAME})
 
-# include GLM
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} "${ROOT_DIR}")
-
-# link required libraries on UNIX
-if (APPLE)
-  find_library(CoreServices CoreServices)
-  set(DEPENDENCY_LIBRARIES ${CoreServices})
-elseif (UNIX)
-  find_package(Threads REQUIRED)
-  set(DEPENDENCY_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
-endif ()
-
 find_package(Qt5 COMPONENTS Network Widgets)
 
 # bubble up the libraries we are dependent on and link them to ourselves
diff --git a/tests/audio/CMakeLists.txt b/tests/audio/CMakeLists.txt
index b7375a0086..15da1afaa1 100644
--- a/tests/audio/CMakeLists.txt
+++ b/tests/audio/CMakeLists.txt
@@ -1,32 +1,12 @@
 set(TARGET_NAME audio-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-#find_package(Qt5Network REQUIRED)
-#find_package(Qt5Script REQUIRED)
-#find_package(Qt5Widgets REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
-auto_mtc(${TARGET_NAME} ${ROOT_DIR})
-
-#qt5_use_modules(${TARGET_NAME} Network Script Widgets)
-
 #include glm
-include(${MACRO_DIR}/IncludeGLM.cmake)
 include_glm(${TARGET_NAME} ${ROOT_DIR})
 
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(audio ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(networking ${TARGET_NAME} ${ROOT_DIR})
+link_hifi_libraries(${TARGET_NAME} shared audio networking)
 
 IF (WIN32)
     target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
diff --git a/tests/jitter/CMakeLists.txt b/tests/jitter/CMakeLists.txt
index 8000e4af50..3b1d544690 100644
--- a/tests/jitter/CMakeLists.txt
+++ b/tests/jitter/CMakeLists.txt
@@ -1,31 +1,9 @@
 set(TARGET_NAME jitter-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-#find_package(Qt5Network REQUIRED)
-#find_package(Qt5Script REQUIRED)
-#find_package(Qt5Widgets REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-#include(${MACRO_DIR}/AutoMTC.cmake)
-#auto_mtc(${TARGET_NAME} ${ROOT_DIR})
-
-#qt5_use_modules(${TARGET_NAME} Network Script Widgets)
-
-#include glm - because it's a dependency of shared utils...
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} ${ROOT_DIR})
-
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(networking ${TARGET_NAME} ${ROOT_DIR})
+link_hifi_libraries(${TARGET_NAME} shared networking)
 
 IF (WIN32)
     target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
diff --git a/tests/metavoxels/CMakeLists.txt b/tests/metavoxels/CMakeLists.txt
index f4c0695362..233988f849 100644
--- a/tests/metavoxels/CMakeLists.txt
+++ b/tests/metavoxels/CMakeLists.txt
@@ -1,28 +1,13 @@
 set(TARGET_NAME metavoxel-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
 find_package(Qt5 COMPONENTS Network Script Widgets)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
 auto_mtc(${TARGET_NAME} "${ROOT_DIR}")
 
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE "${AUTOMTC_SRC}")
 
-#include glm
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} "${ROOT_DIR}")
-
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(metavoxels ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
+link_hifi_libraries(${TARGET_NAME} metavoxels networking shared)
 
 IF (WIN32)
 	target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
diff --git a/tests/networking/CMakeLists.txt b/tests/networking/CMakeLists.txt
index 64b5f273d1..819229d28f 100644
--- a/tests/networking/CMakeLists.txt
+++ b/tests/networking/CMakeLists.txt
@@ -1,31 +1,9 @@
 set(TARGET_NAME networking-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-#find_package(Qt5Network REQUIRED)
-#find_package(Qt5Script REQUIRED)
-#find_package(Qt5Widgets REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
-auto_mtc(${TARGET_NAME} ${ROOT_DIR})
-
-#qt5_use_modules(${TARGET_NAME} Network Script Widgets)
-
-#include glm
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} ${ROOT_DIR})
-
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(networking ${TARGET_NAME} ${ROOT_DIR})
+link_hifi_libraries(${TARGET_NAME} shared networking)
 
 IF (WIN32)
     target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
diff --git a/tests/octree/CMakeLists.txt b/tests/octree/CMakeLists.txt
index c7a6500b6d..a4888b2c66 100644
--- a/tests/octree/CMakeLists.txt
+++ b/tests/octree/CMakeLists.txt
@@ -1,36 +1,9 @@
 set(TARGET_NAME octree-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-find_package(Qt5Network REQUIRED)
-find_package(Qt5Script REQUIRED)
-find_package(Qt5Widgets REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
-auto_mtc(${TARGET_NAME} ${ROOT_DIR})
-
-qt5_use_modules(${TARGET_NAME} Network Script Widgets)
-
-#include glm
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} ${ROOT_DIR})
-
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(models ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(octree ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(audio ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(networking ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(animation ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(fbx ${TARGET_NAME} ${ROOT_DIR})
-link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
+link_hifi_libraries(${TARGET_NAME} octree)
 
 IF (WIN32)
     # add a definition for ssize_t so that windows doesn't bail
diff --git a/tests/physics/CMakeLists.txt b/tests/physics/CMakeLists.txt
index 643d318f7d..2161723619 100644
--- a/tests/physics/CMakeLists.txt
+++ b/tests/physics/CMakeLists.txt
@@ -1,32 +1,7 @@
 set(TARGET_NAME physics-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-#find_package(Qt5Network REQUIRED)
-#find_package(Qt5Script REQUIRED)
-#find_package(Qt5Widgets REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
-auto_mtc(${TARGET_NAME} ${ROOT_DIR})
-
-#qt5_use_modules(${TARGET_NAME} Network Script Widgets)
-
-#include glm
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} ${ROOT_DIR})
-
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
-
-IF (WIN32)
-    #target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
-ENDIF(WIN32)
+link_hifi_libraries(${TARGET_NAME} shared)
 
diff --git a/tests/shared/CMakeLists.txt b/tests/shared/CMakeLists.txt
index 0785314d36..bea8448f5e 100644
--- a/tests/shared/CMakeLists.txt
+++ b/tests/shared/CMakeLists.txt
@@ -1,32 +1,6 @@
 set(TARGET_NAME shared-tests)
 
-set(ROOT_DIR ../..)
-set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-#find_package(Qt5Network REQUIRED)
-#find_package(Qt5Script REQUIRED)
-#find_package(Qt5Widgets REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-include(${MACRO_DIR}/AutoMTC.cmake)
-auto_mtc(${TARGET_NAME} ${ROOT_DIR})
-
-#qt5_use_modules(${TARGET_NAME} Network Script Widgets)
-
-#include glm
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} ${ROOT_DIR})
-
 # link in the shared libraries
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
-
-IF (WIN32)
-    #target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
-ENDIF(WIN32)
-
+link_hifi_libraries(${TARGET_NAME} shared)
diff --git a/tools/bitstream2json/CMakeLists.txt b/tools/bitstream2json/CMakeLists.txt
index 576406e787..3b3a65c259 100644
--- a/tools/bitstream2json/CMakeLists.txt
+++ b/tools/bitstream2json/CMakeLists.txt
@@ -1,25 +1,2 @@
 set(TARGET_NAME bitstream2json)
-
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-find_package(Qt5 COMPONENTS Network Script Widgets)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
-setup_hifi_project(${TARGET_NAME} TRUE)
-
-link_hifi_library(metavoxels ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
-
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} "${ROOT_DIR}")
-
-IF (WIN32)
-    target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
-ENDIF(WIN32)
-
-target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Script)
+setup_hifi_project(${TARGET_NAME} TRUE)
\ No newline at end of file
diff --git a/tools/json2bitstream/CMakeLists.txt b/tools/json2bitstream/CMakeLists.txt
index 5ff4673298..452f845356 100644
--- a/tools/json2bitstream/CMakeLists.txt
+++ b/tools/json2bitstream/CMakeLists.txt
@@ -1,25 +1,2 @@
 set(TARGET_NAME json2bitstream)
-
-set(ROOT_DIR ../..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
-
-find_package(Qt5 COMPONENTS Network Script Widgets)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
-setup_hifi_project(${TARGET_NAME} TRUE)
-
-link_hifi_library(metavoxels ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
-
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} "${ROOT_DIR}")
-
-IF (WIN32)
-    target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
-ENDIF(WIN32)
-
-target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Script)
+setup_hifi_project(${TARGET_NAME} TRUE)
\ No newline at end of file
diff --git a/voxel-edit/CMakeLists.txt b/voxel-edit/CMakeLists.txt
index 006dfb0599..8c315c92a0 100644
--- a/voxel-edit/CMakeLists.txt
+++ b/voxel-edit/CMakeLists.txt
@@ -1,39 +1,7 @@
 set(TARGET_NAME voxel-edit)
 
-set(ROOT_DIR ..)
-set(MACRO_DIR "${ROOT_DIR}/cmake/macros")
-
-# setup for find modules
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/")
-
-# set up the external glm library
-include(${MACRO_DIR}/IncludeGLM.cmake)
-include_glm(${TARGET_NAME} "${ROOT_DIR}")
-
-find_package(Qt5Script REQUIRED)
-
-include(${MACRO_DIR}/SetupHifiProject.cmake)
 setup_hifi_project(${TARGET_NAME} TRUE)
 
-# link in the shared library
-include(${MACRO_DIR}/LinkHifiLibrary.cmake)
-link_hifi_library(shared ${TARGET_NAME} "${ROOT_DIR}")
-
-# link in the hifi octree library
-link_hifi_library(octree ${TARGET_NAME} "${ROOT_DIR}")
-
-# link in the hifi voxels library
-link_hifi_library(voxels ${TARGET_NAME} "${ROOT_DIR}")
-
-# link in the hifi networking library
-link_hifi_library(networking ${TARGET_NAME} "${ROOT_DIR}")
-
-IF (WIN32)
-	target_link_libraries(${TARGET_NAME} Winmm Ws2_32)
-ENDIF(WIN32)
-
-target_link_libraries(${TARGET_NAME} Qt5::Script)
-
 # add a definition for ssize_t so that windows doesn't bail
 if (WIN32)
   add_definitions(-Dssize_t=long)