From c804a508bb5c80f29dc729ef5700198acfc7ae0f Mon Sep 17 00:00:00 2001
From: "Joseph F. Boudreau" <boudreau@pitt.edu>
Date: Sun, 13 Dec 2020 19:11:53 -0500
Subject: [PATCH] Fixup makefiles so that these examples compile either as
 single directories or as part of a build.  Do not require special versions of
 GeoModel:  I will propose that these examples be distributed not as useful
 compiled executables, but rather as source code, for people to learn from. 
 Additionally, I believe that these should be carefully scrutinized and
 annotated with abundant comments for pedagogical purposes, and probably also
 referenced in the documentation.

---
 GeoModelExamples/GeoActions/CMakeLists.txt               | 6 +++---
 GeoModelExamples/GeoFullPhysVol/CMakeLists.txt           | 6 +++---
 GeoModelExamples/GeoShapeExamples/CMakeLists.txt         | 6 +++---
 GeoModelExamples/GeoShiftUnion/CMakeLists.txt            | 6 +++---
 .../GeoTessellatedSolidExamples/CMakeLists.txt           | 6 +++---
 GeoModelExamples/HelloDummyMaterial/CMakeLists.txt       | 6 +++---
 GeoModelExamples/HelloGeo/CMakeLists.txt                 | 9 ++++++---
 GeoModelExamples/HelloGeoRead/CMakeLists.txt             | 6 +++---
 GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt          | 6 +++---
 GeoModelExamples/HelloGeoWrite/CMakeLists.txt            | 6 +++---
 GeoModelExamples/HelloToy/CMakeLists.txt                 | 6 +++---
 GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt  | 6 +++---
 12 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/GeoModelExamples/GeoActions/CMakeLists.txt b/GeoModelExamples/GeoActions/CMakeLists.txt
index d50bdfe22..7f0efb279 100644
--- a/GeoModelExamples/GeoActions/CMakeLists.txt
+++ b/GeoModelExamples/GeoActions/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(GeoActions)
+#project(GeoActions)
 
 # Compile with C++17
 set(CMAKE_CXX_STANDARD 17)
@@ -15,8 +15,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS ON)
 
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) # when building individually
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED  ) 
+  find_package( GeoModelIO REQUIRED ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/GeoFullPhysVol/CMakeLists.txt b/GeoModelExamples/GeoFullPhysVol/CMakeLists.txt
index f1894f8db..0dafa939e 100644
--- a/GeoModelExamples/GeoFullPhysVol/CMakeLists.txt
+++ b/GeoModelExamples/GeoFullPhysVol/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(GeoFullPhysVolEx)
+#project(GeoFullPhysVolEx)
 
 
 # Compile with C++17
@@ -17,8 +17,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED  )
+  find_package( GeoModelIO REQUIRED  )
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/GeoShapeExamples/CMakeLists.txt b/GeoModelExamples/GeoShapeExamples/CMakeLists.txt
index f9bf3915c..5fc886f48 100644
--- a/GeoModelExamples/GeoShapeExamples/CMakeLists.txt
+++ b/GeoModelExamples/GeoShapeExamples/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(GeoShapeExamples)
+#project(GeoShapeExamples)
 
 
 # Compile with C++17
@@ -17,8 +17,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED ) 
+  find_package( GeoModelIO REQUIRED ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/GeoShiftUnion/CMakeLists.txt b/GeoModelExamples/GeoShiftUnion/CMakeLists.txt
index c8ca4731f..4d16de5fa 100644
--- a/GeoModelExamples/GeoShiftUnion/CMakeLists.txt
+++ b/GeoModelExamples/GeoShiftUnion/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(GeoShiftUnion)
+#project(GeoShiftUnion)
 
 
 # Compile with C++17
@@ -17,8 +17,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED  ) 
+  find_package( GeoModelIO REQUIRED ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt b/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt
index d26058a52..82c2df633 100644
--- a/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt
+++ b/GeoModelExamples/GeoTessellatedSolidExamples/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(GeoTessellatedSolidExample)
+#project(GeoTessellatedSolidExample)
 
 
 # Compile with C++17
@@ -17,8 +17,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED ) 
+  find_package( GeoModelIO REQUIRED) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt b/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt
index 534de9009..69c45abbf 100644
--- a/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt
+++ b/GeoModelExamples/HelloDummyMaterial/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(HelloDummyMaterial)
+#project(HelloDummyMaterial)
 
 # Compile with C++17
 set(CMAKE_CXX_STANDARD 17)
@@ -16,8 +16,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED ) 
+  find_package( GeoModelIO REQUIRED ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/HelloGeo/CMakeLists.txt b/GeoModelExamples/HelloGeo/CMakeLists.txt
index dc419131b..a7964d597 100644
--- a/GeoModelExamples/HelloGeo/CMakeLists.txt
+++ b/GeoModelExamples/HelloGeo/CMakeLists.txt
@@ -12,11 +12,14 @@ set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS ON)
 
-project(HelloGeo)
+#project(HelloGeo)
 
 # Find the needed dependencies, when building individually
-if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) # when building individually
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
+  message (${CMAKE_SOURCE_DIR}) 
+  message (${PROJECT_SOURCE_DIR})
+  
+if ( CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR ) # when buildingindividually
+   find_package( GeoModelCore REQUIRED  ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/HelloGeoRead/CMakeLists.txt b/GeoModelExamples/HelloGeoRead/CMakeLists.txt
index 52c5bdd6c..59f098de3 100644
--- a/GeoModelExamples/HelloGeoRead/CMakeLists.txt
+++ b/GeoModelExamples/HelloGeoRead/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(HelloGeoRead)
+#project(HelloGeoRead)
 
 # Compile with C++17
 set(CMAKE_CXX_STANDARD 17)
@@ -16,8 +16,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED ) 
+  find_package( GeoModelIO REQUIRED )
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt b/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt
index 1a75b73d4..be563d9b3 100644
--- a/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt
+++ b/GeoModelExamples/HelloGeoRead2G4/CMakeLists.txt
@@ -7,15 +7,15 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(HelloGeoRead2G4)
+#project(HelloGeoRead2G4)
 
 # Find includes in current dir
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED  )
+  find_package( GeoModelIO REQUIRED ) 
 endif()
 
 ## External dependencies.
diff --git a/GeoModelExamples/HelloGeoWrite/CMakeLists.txt b/GeoModelExamples/HelloGeoWrite/CMakeLists.txt
index 6e0e7bacd..498d3b3f2 100644
--- a/GeoModelExamples/HelloGeoWrite/CMakeLists.txt
+++ b/GeoModelExamples/HelloGeoWrite/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(HelloGeoWrite)
+#project(HelloGeoWrite)
 
 # Compile with C++17
 set(CMAKE_CXX_STANDARD 17)
@@ -15,8 +15,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS ON)
 
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) # when building individually
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED ) 
+  find_package( GeoModelIO REQUIRED ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/HelloToy/CMakeLists.txt b/GeoModelExamples/HelloToy/CMakeLists.txt
index 0a5f31cdf..aff08b467 100644
--- a/GeoModelExamples/HelloToy/CMakeLists.txt
+++ b/GeoModelExamples/HelloToy/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(HelloToy)
+#project(HelloToy)
 
 # Compile with C++17
 set(CMAKE_CXX_STANDARD 17)
@@ -16,8 +16,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED  ) 
+  find_package( GeoModelIO REQUIRED  ) 
 endif()
 
 # Find includes in current dir
diff --git a/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt b/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt
index b6c04bfb2..2d4aa975f 100644
--- a/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt
+++ b/GeoModelExamples/HelloToyDetectorFactory/CMakeLists.txt
@@ -7,7 +7,7 @@
 
 cmake_minimum_required(VERSION 3.1.0)
 
-project(HelloToyDetectorFactory)
+#project(HelloToyDetectorFactory)
 
 # Compile with C++17
 set(CMAKE_CXX_STANDARD 17)
@@ -16,8 +16,8 @@ set(CMAKE_CXX_EXTENSIONS ON)
 
 # Find the needed dependencies, when building individually
 if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) 
-  find_package( GeoModelCore REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder
-  find_package( GeoModelIO REQUIRED 4.1.0 ) #TODO: the version should be se in the root folder 
+  find_package( GeoModelCore REQUIRED  ) 
+  find_package( GeoModelIO REQUIRED  ) 
 endif()
 
 # Find includes in current dir
-- 
GitLab