From b9e1183b4587fa358b5415f0327ca30a9f7aff0c Mon Sep 17 00:00:00 2001
From: "Christian R. G. Dreher" <c.dreher@kit.edu>
Date: Tue, 24 Aug 2021 15:28:19 +0200
Subject: [PATCH] refactor: Adhere to new cmake usage style.

---
 .../navigation/algorithms/CMakeLists.txt      |  9 ------
 .../navigation/algorithms/test/CMakeLists.txt |  6 ----
 .../armarx/navigation/client/CMakeLists.txt   |  2 +-
 .../navigation/client/test/CMakeLists.txt     |  9 ------
 .../components/ExampleClient/CMakeLists.txt   |  2 +-
 .../NavigationMemory/CMakeLists.txt           |  2 +-
 .../components/Navigator/CMakeLists.txt       |  2 +-
 .../navigation/conversions/CMakeLists.txt     | 15 +++++-----
 .../conversions/test/CMakeLists.txt           |  6 ----
 source/armarx/navigation/core/CMakeLists.txt  | 29 ++++++++++---------
 .../navigation/core/test/CMakeLists.txt       |  6 ----
 .../navigation/factories/CMakeLists.txt       | 17 +++++------
 .../navigation/factories/test/CMakeLists.txt  |  7 -----
 .../navigation/global_planning/CMakeLists.txt | 22 +++++---------
 .../global_planning/test/CMakeLists.txt       |  6 ----
 .../local_planning/test/CMakeLists.txt        |  6 ----
 .../armarx/navigation/memory/CMakeLists.txt   | 19 +++++-------
 .../navigation/memory/test/CMakeLists.txt     |  7 -----
 .../safety_control/test/CMakeLists.txt        |  6 ----
 .../armarx/navigation/server/CMakeLists.txt   | 18 ++++++------
 .../navigation/server/test/CMakeLists.txt     |  9 ------
 .../trajectory_control/CMakeLists.txt         | 20 +++++++++----
 .../trajectory_control/test/CMakeLists.txt    |  6 ----
 .../navigation/util/test/CMakeLists.txt       |  6 ----
 24 files changed, 73 insertions(+), 164 deletions(-)
 delete mode 100644 source/armarx/navigation/algorithms/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/client/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/conversions/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/core/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/factories/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/global_planning/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/local_planning/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/memory/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/safety_control/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/server/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/trajectory_control/test/CMakeLists.txt
 delete mode 100644 source/armarx/navigation/util/test/CMakeLists.txt

diff --git a/source/armarx/navigation/algorithms/CMakeLists.txt b/source/armarx/navigation/algorithms/CMakeLists.txt
index bfc7213e..d408bd1b 100644
--- a/source/armarx/navigation/algorithms/CMakeLists.txt
+++ b/source/armarx/navigation/algorithms/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 armarx_add_library(algorithms
     DEPENDENCIES
         ArmarXCoreInterfaces
@@ -24,11 +23,3 @@ armarx_add_library(algorithms
         ./smoothing/ChainApproximation.h
         ./smoothing/CircularPathSmoothing.h
 )
-
-
-# find_package(MyLib QUIET) armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND) for multiple
-# libraries write: if(X_FOUND AND Y_FOUND).... if(MyLib_FOUND)
-# target_include_directories(algorithms PUBLIC ${MyLib_INCLUDE_DIRS}) endif()
-
-# add unit tests add_subdirectory(test)
diff --git a/source/armarx/navigation/algorithms/test/CMakeLists.txt b/source/armarx/navigation/algorithms/test/CMakeLists.txt
deleted file mode 100644
index da23b0c9..00000000
--- a/source/armarx/navigation/algorithms/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME algorithmsTest
-    TEST_FILE algorithmsTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   algorithms
-)
diff --git a/source/armarx/navigation/client/CMakeLists.txt b/source/armarx/navigation/client/CMakeLists.txt
index 6da3e2da..abbbd158 100644
--- a/source/armarx/navigation/client/CMakeLists.txt
+++ b/source/armarx/navigation/client/CMakeLists.txt
@@ -6,7 +6,7 @@ armarx_add_library(client
         # RobotAPI
         aron
         # Navigation
-        NavigatorInterfaces
+        armarx_navigation::Navigator_ice
         armarx_navigation::core
         armarx_navigation::global_planning
         armarx_navigation::local_planning
diff --git a/source/armarx/navigation/client/test/CMakeLists.txt b/source/armarx/navigation/client/test/CMakeLists.txt
deleted file mode 100644
index 2273a1f9..00000000
--- a/source/armarx/navigation/client/test/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-armarx_add_test(
-    TEST_NAME clientTest
-    TEST_FILE clientTest.cpp
-    DEPENDEND_LIBS
-        ArmarXCore
-        armarx_navigation::client
-        armarx_navigation::factories
-        armarx_navigation::server
-)
diff --git a/source/armarx/navigation/components/ExampleClient/CMakeLists.txt b/source/armarx/navigation/components/ExampleClient/CMakeLists.txt
index adc80632..08338b99 100644
--- a/source/armarx/navigation/components/ExampleClient/CMakeLists.txt
+++ b/source/armarx/navigation/components/ExampleClient/CMakeLists.txt
@@ -1,4 +1,4 @@
-armarx__add_component(ExampleClient
+armarx_add_component(ExampleClient
     DEPENDENCIES
         ArmarXCore
         # ArmarXCoreComponentPlugins  # For DebugObserver plugin. ArmarXGui
diff --git a/source/armarx/navigation/components/NavigationMemory/CMakeLists.txt b/source/armarx/navigation/components/NavigationMemory/CMakeLists.txt
index 7b53773a..9398e2c5 100644
--- a/source/armarx/navigation/components/NavigationMemory/CMakeLists.txt
+++ b/source/armarx/navigation/components/NavigationMemory/CMakeLists.txt
@@ -1,4 +1,4 @@
-armarx__add_component(NavigationMemory
+armarx_add_component(NavigationMemory
     DEPENDENCIES
         # ArmarXCore
         ArmarXCore
diff --git a/source/armarx/navigation/components/Navigator/CMakeLists.txt b/source/armarx/navigation/components/Navigator/CMakeLists.txt
index 315e2dbf..9af18dba 100644
--- a/source/armarx/navigation/components/Navigator/CMakeLists.txt
+++ b/source/armarx/navigation/components/Navigator/CMakeLists.txt
@@ -1,4 +1,4 @@
-armarx__add_component(Navigator
+armarx_add_component(Navigator
     ICE_FILES
         NavigatorInterface.ice
     ICE_DEPENDENCIES
diff --git a/source/armarx/navigation/conversions/CMakeLists.txt b/source/armarx/navigation/conversions/CMakeLists.txt
index f81f95f5..b00dce45 100644
--- a/source/armarx/navigation/conversions/CMakeLists.txt
+++ b/source/armarx/navigation/conversions/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 armarx_add_library(conversions
     DEPENDENCIES
         ArmarXCoreInterfaces
@@ -7,10 +6,10 @@ armarx_add_library(conversions
     HEADERS ./eigen.h
 )
 
-# find_package(MyLib QUIET) armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND) for multiple
-# libraries write: if(X_FOUND AND Y_FOUND).... if(MyLib_FOUND)
-# target_include_directories(conversions PUBLIC ${MyLib_INCLUDE_DIRS}) endif()
-
-# add unit tests
-add_subdirectory(test)
+armarx_add_test(
+    TEST_NAME conversions_test
+    TEST_FILE test/conversionsTest.cpp
+    DEPENDEND_LIBS
+        ArmarXCore
+        armarx_navigation::conversions
+)
diff --git a/source/armarx/navigation/conversions/test/CMakeLists.txt b/source/armarx/navigation/conversions/test/CMakeLists.txt
deleted file mode 100644
index 7b63faf2..00000000
--- a/source/armarx/navigation/conversions/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME conversionsTest
-    TEST_FILE conversionsTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::conversions
-)
diff --git a/source/armarx/navigation/core/CMakeLists.txt b/source/armarx/navigation/core/CMakeLists.txt
index a0c1f6dd..88ca66a0 100644
--- a/source/armarx/navigation/core/CMakeLists.txt
+++ b/source/armarx/navigation/core/CMakeLists.txt
@@ -1,3 +1,11 @@
+armarx_add_aron_library(core_aron
+    ARON_FILES
+        aron/Twist.xml
+        aron/TwistLimits.xml
+        aron/PIDParams.xml
+        aron/Trajectory.xml
+        aron/Events.xml
+)
 
 armarx_add_library(core
     DEPENDENCIES
@@ -10,6 +18,7 @@ armarx_add_library(core
         RobotAPIInterfaces
         Simox::VirtualRobot
         range-v3
+        armarx_navigation::core_aron
     SOURCES
         StaticScene.cpp
         Trajectory.cpp
@@ -28,18 +37,12 @@ armarx_add_library(core
         aron_conversions.h
         time/ChronoMonotonicTimeServer.h
         time/TimeServerInterface.h
-    ARON_FILES
-        aron/Twist.xml
-        aron/TwistLimits.xml
-        aron/PIDParams.xml
-        aron/Trajectory.xml
-        aron/Events.xml
 )
 
-# find_package(MyLib QUIET) armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND) for multiple
-# libraries write: if(X_FOUND AND Y_FOUND).... if(MyLib_FOUND)
-# target_include_directories(core PUBLIC ${MyLib_INCLUDE_DIRS}) endif()
-
-# add unit tests
-add_subdirectory(test)
+armarx_add_test(
+    TEST_NAME core_test
+    TEST_FILE test/coreTest.cpp
+    DEPENDEND_LIBS
+        ArmarXCore
+        armarx_navigation::core
+)
diff --git a/source/armarx/navigation/core/test/CMakeLists.txt b/source/armarx/navigation/core/test/CMakeLists.txt
deleted file mode 100644
index c0b9e962..00000000
--- a/source/armarx/navigation/core/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME coreTest
-    TEST_FILE coreTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                    armarx_navigation::core
-)
diff --git a/source/armarx/navigation/factories/CMakeLists.txt b/source/armarx/navigation/factories/CMakeLists.txt
index d532e7d3..6b90e485 100644
--- a/source/armarx/navigation/factories/CMakeLists.txt
+++ b/source/armarx/navigation/factories/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 armarx_add_library(factories
     DEPENDENCIES
         ArmarXCoreInterfaces
@@ -22,11 +21,11 @@ armarx_add_library(factories
         ./NavigationStackFactory.h
 )
 
-
-# find_package(MyLib QUIET) armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND) for multiple
-# libraries write: if(X_FOUND AND Y_FOUND).... if(MyLib_FOUND)
-# target_include_directories(factories PUBLIC ${MyLib_INCLUDE_DIRS}) endif()
-
-# add unit tests
-add_subdirectory(test)
+armarx_add_test(
+    TEST_NAME factories_test
+    TEST_FILE test/factoriesTest.cpp
+    DEPENDEND_LIBS
+        ArmarXCore
+        armarx_navigation::factories
+        armarx_navigation::client
+)
diff --git a/source/armarx/navigation/factories/test/CMakeLists.txt b/source/armarx/navigation/factories/test/CMakeLists.txt
deleted file mode 100644
index 3899f92f..00000000
--- a/source/armarx/navigation/factories/test/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-armarx_add_test(
-    TEST_NAME factoriesTest
-    TEST_FILE factoriesTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::factories
-                   armarx_navigation::client
-)
diff --git a/source/armarx/navigation/global_planning/CMakeLists.txt b/source/armarx/navigation/global_planning/CMakeLists.txt
index b40fa24f..43b7e9e6 100644
--- a/source/armarx/navigation/global_planning/CMakeLists.txt
+++ b/source/armarx/navigation/global_planning/CMakeLists.txt
@@ -1,13 +1,19 @@
-
+armarx_add_aron_library(global_planning_aron
+    ARON_FILES
+        aron/GlobalPlannerParams.xml
+        aron/Point2PointParams.xml
+        aron/AStarParams.xml
+)
 
 armarx_add_library(global_planning
     DEPENDENCIES
+        ceres
         ArmarXCoreInterfaces
         ArmarXCore
         aroncommon
         armarx_navigation::core
         armarx_navigation::algorithms
-        ceres
+        armarx_navigation::global_planning_aron
     SOURCES
         ./GlobalPlanner.cpp
         ./AStar.cpp
@@ -20,16 +26,4 @@ armarx_add_library(global_planning
         ./Point2Point.h
         ./aron_conversions.h
         ./optimization/OrientationOptimizer.h
-    ARON_FILES
-        aron/GlobalPlannerParams.xml
-        aron/Point2PointParams.xml
-        aron/AStarParams.xml
 )
-
-# find_package(MyLib QUIET) armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND) for multiple
-# libraries write: if(X_FOUND AND Y_FOUND).... if(MyLib_FOUND)
-# target_include_directories(global_planning PUBLIC ${MyLib_INCLUDE_DIRS})
-# endif()
-
-# add unit tests add_subdirectory(test)
diff --git a/source/armarx/navigation/global_planning/test/CMakeLists.txt b/source/armarx/navigation/global_planning/test/CMakeLists.txt
deleted file mode 100644
index dc3b1e36..00000000
--- a/source/armarx/navigation/global_planning/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME global_planningTest
-    TEST_FILE global_planningTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::global_planning
-)
diff --git a/source/armarx/navigation/local_planning/test/CMakeLists.txt b/source/armarx/navigation/local_planning/test/CMakeLists.txt
deleted file mode 100644
index 3d26c9e0..00000000
--- a/source/armarx/navigation/local_planning/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME local_planningTest
-    TEST_FILE local_planningTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::core
-)
diff --git a/source/armarx/navigation/memory/CMakeLists.txt b/source/armarx/navigation/memory/CMakeLists.txt
index bf8a5e99..8ae407ee 100644
--- a/source/armarx/navigation/memory/CMakeLists.txt
+++ b/source/armarx/navigation/memory/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 armarx_add_library(memory
     DEPENDENCIES
         ArmarXCoreInterfaces
@@ -19,14 +18,10 @@ armarx_add_library(memory
         ./client/events/Writer.h
 )
 
-
-#find_package(MyLib QUIET)
-#armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND)
-# for multiple libraries write: if(X_FOUND AND Y_FOUND)....
-#if(MyLib_FOUND)
-#    target_include_directories(memory PUBLIC ${MyLib_INCLUDE_DIRS})
-#endif()
-
-# add unit tests
-add_subdirectory(test)
+armarx_add_test(
+    TEST_NAME memory_test
+    TEST_FILE test/memoryTest.cpp
+    DEPENDEND_LIBS
+        ArmarXCore
+        armarx_navigation::memory
+)
diff --git a/source/armarx/navigation/memory/test/CMakeLists.txt b/source/armarx/navigation/memory/test/CMakeLists.txt
deleted file mode 100644
index e68ad9e0..00000000
--- a/source/armarx/navigation/memory/test/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-armarx_add_test(
-    TEST_NAME memoryTest
-    TEST_FILE memoryTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::memory
-)
diff --git a/source/armarx/navigation/safety_control/test/CMakeLists.txt b/source/armarx/navigation/safety_control/test/CMakeLists.txt
deleted file mode 100644
index 30633534..00000000
--- a/source/armarx/navigation/safety_control/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME safety_controlTest
-    TEST_FILE safety_controlTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::safety_control
-)
diff --git a/source/armarx/navigation/server/CMakeLists.txt b/source/armarx/navigation/server/CMakeLists.txt
index 3a0201f4..01d668ad 100644
--- a/source/armarx/navigation/server/CMakeLists.txt
+++ b/source/armarx/navigation/server/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 armarx_add_library(server
     DEPENDENCIES
         ArmarXCoreInterfaces
@@ -45,11 +44,12 @@ armarx_add_library(server
         ./parameterization/MemoryParameterizationService.h
 )
 
-
-# find_package(MyLib QUIET) armarx_build_if(MyLib_FOUND "MyLib not available")
-# all target_include_directories must be guarded by if(Xyz_FOUND) for multiple
-# libraries write: if(X_FOUND AND Y_FOUND).... if(MyLib_FOUND)
-# target_include_directories(server PUBLIC ${MyLib_INCLUDE_DIRS}) endif()
-
-# add unit tests
-add_subdirectory(test)
+armarx_add_test(
+    TEST_NAME server_test
+    TEST_FILE test/serverTest.cpp
+    DEPENDEND_LIBS
+        ArmarXCore
+        armarx_navigation::client
+        armarx_navigation::factories
+        armarx_navigation::server
+)
diff --git a/source/armarx/navigation/server/test/CMakeLists.txt b/source/armarx/navigation/server/test/CMakeLists.txt
deleted file mode 100644
index b301fdde..00000000
--- a/source/armarx/navigation/server/test/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-armarx_add_test(
-    TEST_NAME serverTest
-    TEST_FILE serverTest.cpp
-    DEPENDEND_LIBS
-        ArmarXCore
-        armarx_navigation::client
-        armarx_navigation::factories
-        armarx_navigation::server
-)
diff --git a/source/armarx/navigation/trajectory_control/CMakeLists.txt b/source/armarx/navigation/trajectory_control/CMakeLists.txt
index aa6d4997..c0fe1f69 100644
--- a/source/armarx/navigation/trajectory_control/CMakeLists.txt
+++ b/source/armarx/navigation/trajectory_control/CMakeLists.txt
@@ -1,3 +1,9 @@
+armarx_add_aron_library(trajectory_control_aron
+    ARON_FILES
+        aron/TrajectoryControllerParams.xml
+        aron/TrajectoryFollowingControllerParams.xml
+        aron/WaypointControllerParams.xml
+)
 
 armarx_add_library(trajectory_control
     DEPENDENCIES
@@ -5,6 +11,7 @@ armarx_add_library(trajectory_control
         ArmarXCore
         RobotAPICore
         armarx_navigation::core
+        armarx_navigation::trajectory_control_aron
     SOURCES
         ./TrajectoryController.cpp
         ./TrajectoryFollowingController.cpp
@@ -15,11 +22,12 @@ armarx_add_library(trajectory_control
         ./TrajectoryFollowingController.h
         ./WaypointController.h
         ./aron_conversions.h
-    ARON_FILES
-        aron/TrajectoryControllerParams.xml
-        aron/TrajectoryFollowingControllerParams.xml
-        aron/WaypointControllerParams.xml
 )
 
-# add unit tests
-add_subdirectory(test)
+armarx_add_test(
+    TEST_NAME trajectory_control_test
+    TEST_FILE test/trajectory_controlTest.cpp
+    DEPENDEND_LIBS
+        ArmarXCore
+        armarx_navigation::trajectory_control
+)
diff --git a/source/armarx/navigation/trajectory_control/test/CMakeLists.txt b/source/armarx/navigation/trajectory_control/test/CMakeLists.txt
deleted file mode 100644
index 206297c1..00000000
--- a/source/armarx/navigation/trajectory_control/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME trajectory_controlTest
-    TEST_FILE trajectory_controlTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::trajectory_control
-)
diff --git a/source/armarx/navigation/util/test/CMakeLists.txt b/source/armarx/navigation/util/test/CMakeLists.txt
deleted file mode 100644
index bc28c118..00000000
--- a/source/armarx/navigation/util/test/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-armarx_add_test(
-    TEST_NAME utilTest
-    TEST_FILE utilTest.cpp
-    DEPENDEND_LIBS ArmarXCore
-                   armarx_navigation::util
-)
-- 
GitLab