From b21384c28e6d5e720fe62b76b996fdd712761a62 Mon Sep 17 00:00:00 2001
From: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
Date: Sat, 18 Dec 2021 00:41:07 -0500
Subject: [PATCH] COMP: Simplify and fix handling of iMSTK_USE_OpenHaptics
 option

This commit sets the cache variable prior configuring the outer
build (SUPERBUILD=ON) and it makes sure it is also propagated
down to the inner project.
---
 CMakeLists.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19040cc93..28d3a66fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,6 +146,11 @@ if(iMSTK_USE_PHYSX)
     )
 endif()
 
+option(iMSTK_USE_OpenHaptics "Use OpenHaptic Support." OFF)
+if(NOT WIN32 AND iMSTK_USE_OpenHaptics)
+  message(FATAL_ERROR "Setting iMSTK_USE_OpenHaptics to ON is only supported on Windows")
+endif()
+
 #-----------------------------------------------------------------------------
 # CTest/Dashboards
 #-----------------------------------------------------------------------------
@@ -180,11 +185,6 @@ if(${PROJECT_NAME}_SUPERBUILD)
       message(WARN "Uncrustify requires a python interpreter, please install python and rerun configure")
     endif()
   endif()
-
-  option(${PROJECT_NAME}_USE_OpenHaptics "Use OpenHaptic Support." OFF)
-  if(NOT WIN32 AND ${PROJECT_NAME}_USE_OpenHaptics)
-    message(FATAL_ERROR "Setting ${PROJECT_NAME}_USE_OpenHaptics to ON is only supported on Windows")
-  endif()
   
   imstk_define_dependency(Assimp)
   imstk_define_dependency(Eigen3)
-- 
GitLab