From 1ce7c1671a45c97bb3497740a7888aa6422ef742 Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Wed, 7 Oct 2009 14:41:32 +0000
Subject: [PATCH] Bug 1310: - New lofar_package() macro replaces
 lofar_add_package(). The new macro   supports recursive addition of LOFAR
 packages, using the dependencies passed   as arguments. For example:    
 lofar_package(Blob 1.0 DEPENDS Common)   will add the package Common to the
 build (unless it was already added).   This new features enables a "top-down"
 package specification order, which is   required for building subsystems.

- New lofar_add_package() macro replaces lofar_add_subdirectory(). This macro
  uses a ${pkg}_SOURCE_DIR variable to locate the source directory of the
  package <pkg>. This information is needed, as we cannot simply include
  actual subdirectories anymore, because dependent package(s) might be located
  in a different directory tree.

- New file LofarPackageList.cmake, which sets the ${pkg}_SOURCE_DIR variables.
  This file is generated by a script gen_LofarPackageList_cmake.sh, which must
  be rerun when LOFAR packages are added, moved, or removed.
---
 CEP/CMakeLists.txt                            |  16 +-
 CEP/Calibration/BBSControl/CMakeLists.txt     |   4 +-
 .../BBSControl/scripts/CMakeLists.txt         |  29 +++
 CEP/Calibration/BBSKernel/CMakeLists.txt      |   4 +-
 CEP/Calibration/CMakeLists.txt                |   4 +-
 CEP/DP3/CMakeLists.txt                        |   4 +-
 CEP/DP3/DPPP/CMakeLists.txt                   |   4 +-
 CEP/Imager/CMakeLists.txt                     |   4 +-
 CEP/Imager/MWControl/CMakeLists.txt           |   4 +-
 CEP/Imager/MWImager/CMakeLists.txt            |   4 +-
 CEP/MS/CMakeLists.txt                         |   4 +-
 CEP/MWCommon/CMakeLists.txt                   |   4 +-
 CEP/ParmDB/CMakeLists.txt                     |   4 +-
 CEP/Pipeline/CMakeLists.txt                   |   4 +-
 CEP/pyparmdb/CMakeLists.txt                   |   4 +-
 CMake/LofarAddPackage.cmake                   | 108 -----------
 CMake/LofarMacros.cmake                       |  27 ---
 CMake/LofarPackage.cmake                      | 180 ++++++++++++++++++
 CMake/LofarPackageList.cmake                  |  96 ++++++++++
 CMake/PythonInstall.cmake                     |   3 +-
 CMake/gen_LofarPackageList_cmake.sh           |  79 ++++++++
 CMakeLists.txt                                |  29 +--
 LCS/ACC/ALC/CMakeLists.txt                    |   4 +-
 LCS/ACC/CMakeLists.txt                        |   4 +-
 LCS/ACC/PLC/CMakeLists.txt                    |   4 +-
 LCS/AMC/AMCBase/CMakeLists.txt                |   4 +-
 LCS/AMC/AMCImpl/CMakeLists.txt                |   4 +-
 LCS/AMC/CMakeLists.txt                        |   4 +-
 LCS/ApplCommon/CMakeLists.txt                 |   4 +-
 LCS/Blob/CMakeLists.txt                       |   4 +-
 LCS/CMakeLists.txt                            |  21 +-
 LCS/Common/CMakeLists.txt                     |   4 +-
 LCS/Stream/CMakeLists.txt                     |   4 +-
 LCS/Tools/CMakeLists.txt                      |   4 +-
 LCS/Transport/CMakeLists.txt                  |   4 +-
 LCS/pyparameterset/CMakeLists.txt             |   4 +-
 LCS/pytools/CMakeLists.txt                    |   4 +-
 LCU/CMakeLists.txt                            |   4 +-
 LCU/Firmware/CMakeLists.txt                   |   2 +-
 MAC/APL/APLCommon/CMakeLists.txt              |   4 +-
 MAC/APL/CEPCU/CMakeLists.txt                  |   4 +-
 MAC/APL/CMakeLists.txt                        |  26 +--
 MAC/APL/CUDaemons/CMakeLists.txt              |   4 +-
 MAC/APL/CURTDBDaemons/CMakeLists.txt          |   4 +-
 MAC/APL/MD_Protocol/CMakeLists.txt            |   4 +-
 MAC/APL/MainCU/CMakeLists.txt                 |   4 +-
 MAC/APL/PAC/BS_Protocol/CMakeLists.txt        |   4 +-
 MAC/APL/PAC/Beam_Server/CMakeLists.txt        |   4 +-
 MAC/APL/PAC/CAL_Protocol/CMakeLists.txt       |   4 +-
 MAC/APL/PAC/CMakeLists.txt                    |  10 +-
 MAC/APL/PAC/Cal_Server/CMakeLists.txt         |   4 +-
 MAC/APL/PAC/SHMInfo_Server/CMakeLists.txt     |   4 +-
 MAC/APL/PIC/CMakeLists.txt                    |   8 +-
 MAC/APL/PIC/RSP_Driver/CMakeLists.txt         |   4 +-
 MAC/APL/PIC/RSP_Protocol/CMakeLists.txt       |   4 +-
 MAC/APL/PIC/TBB_Driver/CMakeLists.txt         |   4 +-
 MAC/APL/PIC/TBB_Protocol/CMakeLists.txt       |   4 +-
 MAC/APL/RTCCommon/CMakeLists.txt              |   4 +-
 MAC/APL/RTDBCommon/CMakeLists.txt             |   4 +-
 MAC/APL/StationCU/CMakeLists.txt              |   4 +-
 MAC/APL/TestCtlr/CMakeLists.txt               |   4 +-
 MAC/APL/TestSuite/CMakeLists.txt              |   4 +-
 MAC/APL/VHECR/CMakeLists.txt                  |   4 +-
 MAC/CMakeLists.txt                            |  12 +-
 MAC/Deployment/CMakeLists.txt                 |   4 +-
 MAC/GCF/CMakeLists.txt                        |   6 +-
 MAC/GCF/PVSS/CMakeLists.txt                   |   4 +-
 MAC/GCF/RTDB/CMakeLists.txt                   |   4 +-
 MAC/GCF/TM/CMakeLists.txt                     |   4 +-
 MAC/MACIO/CMakeLists.txt                      |   4 +-
 MAC/Navigator2/CMakeLists.txt                 |   4 +-
 MAC/Tools/CMakeLists.txt                      |   4 +-
 RTCP/CMakeLists.txt                           |  14 +-
 RTCP/CNProc/CMakeLists.txt                    |   4 +-
 RTCP/FCNP/CMakeLists.txt                      |   4 +-
 RTCP/IONProc/CMakeLists.txt                   |   4 +-
 RTCP/Interface/CMakeLists.txt                 |   4 +-
 RTCP/RTCPTools/CMakeLists.txt                 |   4 +-
 RTCP/Storage/CMakeLists.txt                   |   4 +-
 SAS/CMakeLists.txt                            |   4 +-
 SAS/OTB/CMakeLists.txt                        |   4 +-
 SAS/OTB/jOTDB2/CMakeLists.txt                 |   4 +-
 SAS/OTDB/CMakeLists.txt                       |   4 +-
 83 files changed, 583 insertions(+), 347 deletions(-)
 create mode 100644 CEP/Calibration/BBSControl/scripts/CMakeLists.txt
 delete mode 100644 CMake/LofarAddPackage.cmake
 create mode 100644 CMake/LofarPackage.cmake
 create mode 100644 CMake/LofarPackageList.cmake
 create mode 100755 CMake/gen_LofarPackageList_cmake.sh

diff --git a/CEP/CMakeLists.txt b/CEP/CMakeLists.txt
index 20d47d86284..f781089a361 100644
--- a/CEP/CMakeLists.txt
+++ b/CEP/CMakeLists.txt
@@ -34,15 +34,15 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(MWCommon)
-lofar_add_subdirectory(MS)
-lofar_add_subdirectory(ParmDB)
-lofar_add_subdirectory(Calibration)
-lofar_add_subdirectory(DP3)
-lofar_add_subdirectory(Imager)
+lofar_add_package(MWCommon)
+lofar_add_package(MS)
+lofar_add_package(ParmDB)
+lofar_add_package(Calibration)
+lofar_add_package(DP3)
+lofar_add_package(Imager)
 
-lofar_add_subdirectory(Pipeline)
-lofar_add_subdirectory(pyparmdb)
+lofar_add_package(Pipeline)
+lofar_add_package(pyparmdb)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/CEP/Calibration/BBSControl/CMakeLists.txt b/CEP/Calibration/BBSControl/CMakeLists.txt
index 1f3b8dda918..a48c7b56622 100644
--- a/CEP/Calibration/BBSControl/CMakeLists.txt
+++ b/CEP/Calibration/BBSControl/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(BBSControl)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS BBSKernel Blob Common MWCommon ParmDB PLC Transport)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS BBSKernel Blob Common MWCommon ParmDB PLC Transport)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/Calibration/BBSControl/scripts/CMakeLists.txt b/CEP/Calibration/BBSControl/scripts/CMakeLists.txt
new file mode 100644
index 00000000000..302699cdec9
--- /dev/null
+++ b/CEP/Calibration/BBSControl/scripts/CMakeLists.txt
@@ -0,0 +1,29 @@
+# $Id$
+#
+# Copyright (C) 2008-2009
+# ASTRON (Netherlands Foundation for Research in Astronomy)
+# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+include(PythonInstall)
+
+# Python modules.
+python_install(
+  __init__.py 
+  solfetch.py
+  solplot.py
+  solflag.py
+  DESTINATION lofar/solutions)
diff --git a/CEP/Calibration/BBSKernel/CMakeLists.txt b/CEP/Calibration/BBSKernel/CMakeLists.txt
index b8568e073f2..9ea28d176db 100644
--- a/CEP/Calibration/BBSKernel/CMakeLists.txt
+++ b/CEP/Calibration/BBSKernel/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(BBSKernel)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Blob Common ParmDB)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Blob Common ParmDB)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/Calibration/CMakeLists.txt b/CEP/Calibration/CMakeLists.txt
index 26991fb4d48..1d84fbd7eac 100644
--- a/CEP/Calibration/CMakeLists.txt
+++ b/CEP/Calibration/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(BBSKernel)
-lofar_add_subdirectory(BBSControl)
+lofar_add_package(BBSKernel)
+lofar_add_package(BBSControl)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/CEP/DP3/CMakeLists.txt b/CEP/DP3/CMakeLists.txt
index bde180eae0f..4e6326a83a7 100644
--- a/CEP/DP3/CMakeLists.txt
+++ b/CEP/DP3/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(DPPP)
-lofar_add_subdirectory(SPWCombine)
+lofar_add_package(DPPP)
+lofar_add_package(SPWCombine)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/CEP/DP3/DPPP/CMakeLists.txt b/CEP/DP3/DPPP/CMakeLists.txt
index e1ffb0f02c0..c22132a7ace 100644
--- a/CEP/DP3/DPPP/CMakeLists.txt
+++ b/CEP/DP3/DPPP/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(DPPP)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common MS PLC)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common MS PLC)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/Imager/CMakeLists.txt b/CEP/Imager/CMakeLists.txt
index 750415e1796..189e72625bf 100644
--- a/CEP/Imager/CMakeLists.txt
+++ b/CEP/Imager/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(MWControl)
-lofar_add_subdirectory(MWImager)
+lofar_add_package(MWControl)
+lofar_add_package(MWImager)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/CEP/Imager/MWControl/CMakeLists.txt b/CEP/Imager/MWControl/CMakeLists.txt
index 0470507dc1e..b3c0b79d1d4 100644
--- a/CEP/Imager/MWControl/CMakeLists.txt
+++ b/CEP/Imager/MWControl/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(MWControl)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob MWCommon ParmDB BBSKernel)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob MWCommon ParmDB BBSKernel)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/Imager/MWImager/CMakeLists.txt b/CEP/Imager/MWImager/CMakeLists.txt
index 38c72fdaf96..5e8fe53aed7 100644
--- a/CEP/Imager/MWImager/CMakeLists.txt
+++ b/CEP/Imager/MWImager/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(MWImager)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common MWCommon)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS Common MWCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/MS/CMakeLists.txt b/CEP/MS/CMakeLists.txt
index 55c42dfa233..641e660cbd5 100644
--- a/CEP/MS/CMakeLists.txt
+++ b/CEP/MS/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(MS)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob MWCommon)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob MWCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/MWCommon/CMakeLists.txt b/CEP/MWCommon/CMakeLists.txt
index 476234e62cb..76ffa83afe4 100644
--- a/CEP/MWCommon/CMakeLists.txt
+++ b/CEP/MWCommon/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(MWCommon)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/ParmDB/CMakeLists.txt b/CEP/ParmDB/CMakeLists.txt
index e636e2bc5da..1b71edfc6e3 100644
--- a/CEP/ParmDB/CMakeLists.txt
+++ b/CEP/ParmDB/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(ParmDB)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common Blob MWCommon)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common Blob MWCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/Pipeline/CMakeLists.txt b/CEP/Pipeline/CMakeLists.txt
index c83b60f37ac..6d6ec608a21 100644
--- a/CEP/Pipeline/CMakeLists.txt
+++ b/CEP/Pipeline/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Pipeline)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS pytools)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS pytools)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CEP/pyparmdb/CMakeLists.txt b/CEP/pyparmdb/CMakeLists.txt
index 3bcd1a21fa6..e0c47858275 100644
--- a/CEP/pyparmdb/CMakeLists.txt
+++ b/CEP/pyparmdb/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(pyparmdb)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common ParmDB)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common ParmDB)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/CMake/LofarAddPackage.cmake b/CMake/LofarAddPackage.cmake
deleted file mode 100644
index e10eca71847..00000000000
--- a/CMake/LofarAddPackage.cmake
+++ /dev/null
@@ -1,108 +0,0 @@
-#  $Id$
-#
-#  Copyright (C) 2008-2009
-#  ASTRON (Netherlands Foundation for Research in Astronomy)
-#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-#
-#  This program is free software; you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-# --------------------------------------------------------------------------
-# lofar_add_package(<name> [version] [DEPENDS <depend> [depend] ...])
-#
-# Add a LOFAR package. 
-#
-# This function performs the following actions:
-# - Create a custom target for package <name>, using add_custom_target().
-# - If package <name> has dependencies, then, for each dependency <dep>:
-#   - add a dependency of package <name> on package <dep>
-#   - add the list of include directories of <dep> to that of <name>
-# - Add a preprocessor definition for LOFARLOGGER_PACKAGE
-#
-# This function sets the following variables in the parent scope:
-#   ${name}_VERSION       Version number of package <name>
-#   ${name}_DEPENDENCIES  List of packages that package <name> depends on.
-#
-# --------------------------------------------------------------------------
-function(lofar_add_package _name)
-
-  set(_errmsg 
-    "Wrong arguments supplied to lofar_add_package().\n"
-    "Usage: lofar_add_package(name [version] [DEPENDS depend ...])\n")
-
-  # Print message to console if configuring verbose.
-  if(LOFAR_VERBOSE_CONFIGURE)
-    message(STATUS "Adding package ${_name}...")
-  endif(LOFAR_VERBOSE_CONFIGURE)
-
-  # If arguments were given, then the first could be a version number.
-  if(ARGC GREATER 1)
-    list(GET ARGV 1 _version)
-    string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*$" _version ${_version})
-  endif(ARGC GREATER 1)
-  
-  # If two arguments were given, then the second must be a version number.
-  if(ARGC EQUAL 2 AND NOT _version)
-    message(FATAL_ERROR ${_errmsg})
-  endif(ARGC EQUAL 2 AND NOT _version)
-
-  # If more than two arguments were given, then search for the DEPENDS
-  # keyword, which must be present.
-  if(ARGC GREATER 2)
-    list(FIND ARGV DEPENDS _idx)
-    if(_idx EQUAL -1)
-      message(FATAL_ERROR ${_errmsg})
-    endif(_idx EQUAL -1)
-    # Let _idx point to the first argument of DEPENDS
-    math(EXPR _idx "${_idx}+1")
-    if(NOT _idx LESS ARGC)
-      # Missing arguments after DEPENDS
-      message(FATAL_ERROR ${_errmsg})
-    endif(NOT _idx LESS ARGC)
-    # Add dependencies to the dependency list
-    while(_idx LESS ARGC)
-      list(GET ARGV ${_idx} _dep)
-      list(APPEND _dependencies ${_dep})
-      math(EXPR _idx "${_idx}+1")
-    endwhile(_idx LESS ARGC)
-  endif(ARGC GREATER 2)
-
-  # Create a custom target for package <name> that depends on 'all'.
-  add_custom_target(${_name} ALL)
-
-  # For each package <pkg> that this package depends on:
-  # - add a dependency of package <name> on package <pkg>
-  # - add the list of include directories of <pkg> to that of package <name>
-  foreach(_dep ${_dependencies})
-    get_directory_property(_dirs 
-      DIRECTORY ${${_dep}_SOURCE_DIR} INCLUDE_DIRECTORIES)
-    add_dependencies(${_name} ${_dep})
-#    message(STATUS "set(BUILD_${_dep} TRUE CACHE BOOL \"Build ${_dep}?\"")
-#    set(BUILD_${_dep} TRUE CACHE BOOL "Build ${_dep}?")
-    include_directories(${_dirs})
-  endforeach(_dep ${_dependencies})
-
-  # Set LOFAR Logger package name to the current project
-  string(REGEX REPLACE "^${LOFAR_ROOT}" "" _pkg "${${_name}_SOURCE_DIR}")
-  string(REGEX REPLACE "^/" "" _pkg "${_pkg}")
-  string(REPLACE "/" "." _pkg "${_pkg}")
-  add_definitions(-DLOFARLOGGER_PACKAGE="${_pkg}")
-
-  # Export variables to the parent scope
-  set(LOFAR_PACKAGE_NAME ${_name} PARENT_SCOPE)
-  set(${_name}_VERSION ${_version} PARENT_SCOPE)
-  set(${_name}_DEPENDENCIES ${_dependencies} PARENT_SCOPE)
-
-endfunction(lofar_add_package _name)
-  
diff --git a/CMake/LofarMacros.cmake b/CMake/LofarMacros.cmake
index 8d6aaf9f763..636db20bf39 100644
--- a/CMake/LofarMacros.cmake
+++ b/CMake/LofarMacros.cmake
@@ -31,7 +31,6 @@
 #   lofar_add_executable(name)
 #   lofar_add_library(name)
 #   lofar_add_sbin_program(name)
-#   lofar_add_subdirectory(name)
 #   lofar_add_test(name)
 #   lofar_get_date(date)
 #   lofar_get_hostname(name)
@@ -171,32 +170,6 @@ if(NOT DEFINED LOFAR_MACROS_INCLUDED)
   endmacro(lofar_add_sbin_program _name)
 
 
-  # --------------------------------------------------------------------------
-  # lofar_add_subdirectory(srcdir [bindir] [REQUIRED])
-  #
-  # Add a subdirectory like add_subdirectory() does.
-  # Furthermore:
-  # - It is not an error is the directory does not exist, unless the REQUIRED
-  #   keyword is specified.
-  # - If [bindir] is not supplied, it is determined on the fly, so the user
-  #   doesn't have to bother when specifying an out-of-tree source.
-  # --------------------------------------------------------------------------
-  macro(lofar_add_subdirectory srcdir)
-    get_filename_component(_srcdir ${srcdir} ABSOLUTE)
-    string(REGEX MATCH ";?REQUIRED.*" _required "${ARGN}")
-    string(REPLACE "${_required}" "" _bindir "${ARGN}")
-    if(_bindir MATCHES "^.+$")
-      get_filename_component(_bindir ${_bindir} ABSOLUTE)
-    else(_bindir MATCHES "^.+$")
-      string(REGEX REPLACE
-        ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _bindir ${_srcdir})
-    endif(_bindir MATCHES "^.+$")
-    if(_required OR EXISTS ${_srcdir})
-      add_subdirectory(${_srcdir} ${_bindir})
-    endif(_required OR EXISTS ${_srcdir})
-  endmacro(lofar_add_subdirectory)
-
-
   # --------------------------------------------------------------------------
   # lofar_add_test(name [source ...] [DEPENDS depend ...])
   #
diff --git a/CMake/LofarPackage.cmake b/CMake/LofarPackage.cmake
new file mode 100644
index 00000000000..65c86ffd645
--- /dev/null
+++ b/CMake/LofarPackage.cmake
@@ -0,0 +1,180 @@
+#  $Id$
+#
+#  Copyright (C) 2008-2009
+#  ASTRON (Netherlands Foundation for Research in Astronomy)
+#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# --------------------------------------------------------------------------
+# LOFAR package related macros
+#
+# Defines the following macros:
+#   lofar_add_package(pkg [srcdir] [REQUIRED])
+#   lofar_package(<name> [version] [DEPENDS <depend> [depend] ...])
+# --------------------------------------------------------------------------
+
+
+# --------------------------------------------------------------------------
+# lofar_add_package(pkg [srcdir] [REQUIRED])
+#
+# Add a LOFAR package to the build, unless it is excluded from the build
+# (i.e., option BUILD_<pkg> is OFF).
+#
+# Adding a package implies:
+# - If the target <pkg> is not yet defined, and if the package source
+#   directory exists:
+#   - define the option BUILD_<pkg>
+#   - add a custom target <pkg>
+#   - add the source directory to the build
+# - If the target <pkg> is defined:
+#   - add a dependency of the current project on package <pkg>
+#
+# Furthermore:
+# - if [srcdir] is not supplied, <pkg>_SOURCE_DIR is used as directory name,
+#   unless <pkg>_SOURCE_DIR is undefined, in which case <pkg> is used.
+# - it is not an error if the package source directory does not exist, 
+#   unless the REQUIRED keyword is specified.
+# --------------------------------------------------------------------------
+macro(lofar_add_package _pkg)
+  if(NOT DEFINED BUILD_${_pkg} OR BUILD_${_pkg})
+    if(NOT TARGET ${_pkg})
+      string(REGEX REPLACE ";?REQUIRED$" "" _srcdir "${ARGN}")
+      string(REGEX MATCH "REQUIRED$" _required "${ARGN}")
+      if(_srcdir MATCHES "^$")
+        if(DEFINED ${_pkg}_SOURCE_DIR)
+          set(_srcdir ${${_pkg}_SOURCE_DIR})
+        else(DEFINED ${_pkg}_SOURCE_DIR)
+#          message(STATUS "Variable ${_pkg}_SOURCE_DIR is undefined")
+          set(_srcdir ${_pkg})
+        endif(DEFINED ${_pkg}_SOURCE_DIR)
+      endif(_srcdir MATCHES "^$")
+      get_filename_component(_srcdir ${_srcdir} ABSOLUTE)
+      string(REGEX REPLACE
+        ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _bindir ${_srcdir})
+      if(EXISTS ${_srcdir})
+        option(BUILD_${_pkg} "Build package ${_pkg}?" ON)
+        mark_as_advanced(BUILD_${_pkg})
+        message(STATUS "Adding package ${_pkg}...")
+        add_custom_target(${_pkg})
+        add_subdirectory(${_srcdir} ${_bindir})
+      else(EXISTS ${_srcdir})
+        set(_errmsg "Source package `${_pkg}' not found! "
+          "Directory ${_srcdir} does not exist")
+        if(_required)
+          message(FATAL_ERROR ${_errmsg})
+        else(_required)
+          message(STATUS ${_errmsg})
+        endif(_required)
+      endif(EXISTS ${_srcdir})
+    endif(NOT TARGET ${_pkg})
+    if(TARGET ${_pkg})
+      add_dependencies(${LOFAR_PACKAGE_NAME} ${_pkg})
+    endif(TARGET ${_pkg})
+  endif(NOT DEFINED BUILD_${_pkg} OR BUILD_${_pkg})
+endmacro(lofar_add_package _pkg)
+
+
+# --------------------------------------------------------------------------
+# lofar_package(<pkg> [version] [DEPENDS <depend> [depend] ...])
+#
+# Define a LOFAR package. 
+#
+# This macro sets the following variables:
+#   LOFAR_PACKAGE_NAME   Name of package <pkg>
+#   ${pkg}_VERSION       Version number of package <pkg>
+#   ${pkg}_DEPENDENCIES  List of packages that package <pkg> depends on.
+#
+# Each dependent package is added to the build. If any of these packages is
+# excluded from the build (e.g., because BUILD_<dep> is OFF), then package
+# <pkg> will also be excluded from the build.
+#
+# The include directories of each dependent package will be added to the
+# include directories of package <pkg>. This is needed, because CMake does not
+# retain the include path across source directories.
+#
+# A preprocessor definition for LOFARLOGGER_PACKAGE is added.
+# --------------------------------------------------------------------------
+macro(lofar_package _pkg)
+
+  set(_errmsg 
+    "Wrong arguments supplied to lofar_package().\n"
+    "Usage: lofar_package(pkg [version] [DEPENDS depend ...])\n")
+
+  # Define a target for the current package, if it is not defined yet.
+  if(NOT TARGET ${_pkg})
+    add_custom_target(${_pkg})
+  endif(NOT TARGET ${_pkg})
+
+  # Use LOFAR_PACKAGE_NAME to store the name of the current LOFAR package
+  set(LOFAR_PACKAGE_NAME ${_pkg})
+
+  # Get the optional version number; a string of dot-separated numbers
+  string(REGEX REPLACE ";?DEPENDS.*" "" ${_pkg}_VERSION "${ARGN}")
+  if(NOT ${_pkg}_VERSION MATCHES "^([0-9]+(\\.[0-9]+)*)?$")
+    message(FATAL_ERROR ${_errmsg})
+  endif(NOT ${_pkg}_VERSION MATCHES "^([0-9]+(\\.[0-9]+)*)?$")
+
+  # Get the optional package dependencies
+  string(REGEX MATCH "DEPENDS;?.*" _depends "${ARGN}")
+  if(_depends MATCHES "^.+$")
+    string(REGEX REPLACE "DEPENDS;?" "" ${_pkg}_DEPENDENCIES "${_depends}")
+    if(${_pkg}_DEPENDENCIES MATCHES "^$")
+      message(FATAL_ERROR ${_errmsg})
+    endif(${_pkg}_DEPENDENCIES MATCHES "^$")
+  endif(_depends MATCHES "^.+$")
+
+  if(LOFAR_VERBOSE_CONFIGURE)
+    message(STATUS "  ${_pkg} version: ${${_pkg}_VERSION}")
+    message(STATUS "  ${_pkg} dependencies: ${${_pkg}_DEPENDENCIES}")
+  endif(LOFAR_VERBOSE_CONFIGURE)
+
+  # Add all packages that <pkg> depends on to the build. If any of these
+  # packages are excluded from the build (because BUILD_<dep> is OFF), then
+  # BUILD_<pkg> will also be set to OFF and an error is raised.
+  foreach(_dep ${${_pkg}_DEPENDENCIES})
+
+    # Break out of foreach-loop if building of package <pkg> is disabled.
+    if(DEFINED BUILD_${_pkg} AND NOT BUILD_${_pkg})
+      break()
+    endif(DEFINED BUILD_${_pkg} AND NOT BUILD_${_pkg})
+
+    # Add package <dep> to the build. Don't worry about multiple inclusion;
+    # lofar_add_package() will guard against it.
+    lofar_add_package(${_dep})# REQUIRED)
+
+    # If building of dependent package <dep> is enabled, then add the list
+    # of include directories of <dep> to that of package <pkg>, else disable
+    # building of package <pkg> as well and raise an error.
+    if(BUILD_${_dep})
+      get_directory_property(_dirs
+        DIRECTORY ${${_dep}_SOURCE_DIR} INCLUDE_DIRECTORIES)
+      include_directories(${_dirs})
+    else(BUILD_${_dep})
+      set(BUILD_${_pkg} OFF CACHE BOOL "Build package ${_pkg}" FORCE)
+      message(SEND_ERROR "Package `${_dep}' is excluded from the build, but "
+        "`${_pkg}' depends on it. Package `${_pkg}' will be excluded as well!")
+    endif(BUILD_${_dep})
+
+  endforeach(_dep ${${_pkg}_DEPENDENCIES})
+
+  # Add a preprocessor definition for the LOFAR Logger package
+  string(REGEX REPLACE "^${LOFAR_ROOT}" "" _lpkg "${${_pkg}_SOURCE_DIR}")
+  string(REGEX REPLACE "^/" "" _lpkg "${_lpkg}")
+  string(REPLACE "/" "." _lpkg "${_lpkg}")
+  add_definitions(-DLOFARLOGGER_PACKAGE="${_lpkg}")
+  
+endmacro(lofar_package)
+
diff --git a/CMake/LofarPackageList.cmake b/CMake/LofarPackageList.cmake
new file mode 100644
index 00000000000..daf8c346c2f
--- /dev/null
+++ b/CMake/LofarPackageList.cmake
@@ -0,0 +1,96 @@
+#
+# Generated by gen_LofarPackageList_cmake.sh at Wed Oct  7 15:43:03 CEST 2009
+#
+#                            ---- DO NOT EDIT ----
+#
+#  This file creates for each LOFAR package a variable containing the relative
+#  path to its source directory. 
+#
+#  ATTENTION: This file must be included BEFORE the first call of the
+#  lofar_package() macro; either directly, or indirectly.
+#
+#  NOTE: This file must be kept up-to-date when project directories are added,
+#  moved, or deleted. Use gen_LofarPackageList_cmake.sh to do so.
+#
+if(NOT DEFINED LOFAR_PACKAGE_LIST_INCLUDED)
+  set(LOFAR_PACKAGE_LIST_INCLUDED TRUE)
+  set(MS_SOURCE_DIR CEP/MS)
+  set(DPPP_SOURCE_DIR CEP/DP3/DPPP)
+  set(DP3_SOURCE_DIR CEP/DP3)
+  set(MWCommon_SOURCE_DIR CEP/MWCommon)
+  set(MWImager_SOURCE_DIR CEP/Imager/MWImager)
+  set(Imager_SOURCE_DIR CEP/Imager)
+  set(MWControl_SOURCE_DIR CEP/Imager/MWControl)
+  set(Pipeline_SOURCE_DIR CEP/Pipeline)
+  set(ParmDB_SOURCE_DIR CEP/ParmDB)
+  set(CEP_SOURCE_DIR CEP)
+  set(BBSControl_SOURCE_DIR CEP/Calibration/BBSControl)
+  set(Calibration_SOURCE_DIR CEP/Calibration)
+  set(BBSKernel_SOURCE_DIR CEP/Calibration/BBSKernel)
+  set(pyparmdb_SOURCE_DIR CEP/pyparmdb)
+  set(ALC_SOURCE_DIR LCS/ACC/ALC)
+  set(PLC_SOURCE_DIR LCS/ACC/PLC)
+  set(ACC_SOURCE_DIR LCS/ACC)
+  set(AMC_SOURCE_DIR LCS/AMC)
+  set(AMCBase_SOURCE_DIR LCS/AMC/AMCBase)
+  set(AMCImpl_SOURCE_DIR LCS/AMC/AMCImpl)
+  set(Blob_SOURCE_DIR LCS/Blob)
+  set(Common_SOURCE_DIR LCS/Common)
+  set(pytools_SOURCE_DIR LCS/pytools)
+  set(Tools_SOURCE_DIR LCS/Tools)
+  set(ApplCommon_SOURCE_DIR LCS/ApplCommon)
+  set(Stream_SOURCE_DIR LCS/Stream)
+  set(pyparameterset_SOURCE_DIR LCS/pyparameterset)
+  set(LCS_SOURCE_DIR LCS)
+  set(Transport_SOURCE_DIR LCS/Transport)
+  set(Firmware-Tools_SOURCE_DIR LCU/Firmware/tools)
+  set(Firmware_SOURCE_DIR LCU/Firmware)
+  set(LCU_SOURCE_DIR LCU)
+  set(StationTest_SOURCE_DIR LCU/StationTest)
+  set(BS_Protocol_SOURCE_DIR MAC/APL/PAC/BS_Protocol)
+  set(Beam_Server_SOURCE_DIR MAC/APL/PAC/Beam_Server)
+  set(SHMInfo_Server_SOURCE_DIR MAC/APL/PAC/SHMInfo_Server)
+  set(PAC_SOURCE_DIR MAC/APL/PAC)
+  set(Cal_Server_SOURCE_DIR MAC/APL/PAC/Cal_Server)
+  set(CAL_Protocol_SOURCE_DIR MAC/APL/PAC/CAL_Protocol)
+  set(PIC_SOURCE_DIR MAC/APL/PIC)
+  set(RSP_Protocol_SOURCE_DIR MAC/APL/PIC/RSP_Protocol)
+  set(TBB_Protocol_SOURCE_DIR MAC/APL/PIC/TBB_Protocol)
+  set(RSP_Driver_SOURCE_DIR MAC/APL/PIC/RSP_Driver)
+  set(TBB_Driver_SOURCE_DIR MAC/APL/PIC/TBB_Driver)
+  set(CUDaemons_SOURCE_DIR MAC/APL/CUDaemons)
+  set(TestCtlr_SOURCE_DIR MAC/APL/TestCtlr)
+  set(CEPCU_SOURCE_DIR MAC/APL/CEPCU)
+  set(VHECR_SOURCE_DIR MAC/APL/VHECR)
+  set(MainCU_SOURCE_DIR MAC/APL/MainCU)
+  set(APL_SOURCE_DIR MAC/APL)
+  set(CURTDBDaemons_SOURCE_DIR MAC/APL/CURTDBDaemons)
+  set(StationCU_SOURCE_DIR MAC/APL/StationCU)
+  set(MD_Protocol_SOURCE_DIR MAC/APL/MD_Protocol)
+  set(TestSuite_SOURCE_DIR MAC/APL/TestSuite)
+  set(RTCCommon_SOURCE_DIR MAC/APL/RTCCommon)
+  set(RTDBCommon_SOURCE_DIR MAC/APL/RTDBCommon)
+  set(APLCommon_SOURCE_DIR MAC/APL/APLCommon)
+  set(GCFTM_SOURCE_DIR MAC/GCF/TM)
+  set(GCFPVSS_SOURCE_DIR MAC/GCF/PVSS)
+  set(GCFRTDB_SOURCE_DIR MAC/GCF/RTDB)
+  set(GCF_SOURCE_DIR MAC/GCF)
+  set(MACIO_SOURCE_DIR MAC/MACIO)
+  set(MACTools_SOURCE_DIR MAC/Tools)
+  set(Deployment_SOURCE_DIR MAC/Deployment)
+  set(MAC_SOURCE_DIR MAC)
+  set(Navigator2_SOURCE_DIR MAC/Navigator2)
+  set(OTB_SOURCE_DIR SAS/OTB)
+  set(jOTDB2_SOURCE_DIR SAS/OTB/jOTDB2)
+  set(OTDB_SOURCE_DIR SAS/OTDB)
+  set(SAS_SOURCE_DIR SAS)
+  set(FCNP_SOURCE_DIR RTCP/FCNP)
+  set(RTCP_SOURCE_DIR RTCP)
+  set(Interface_SOURCE_DIR RTCP/Interface)
+  set(RTCPTools_SOURCE_DIR RTCP/RTCPTools)
+  set(Storage_SOURCE_DIR RTCP/Storage)
+  set(IONProc_SOURCE_DIR RTCP/IONProc)
+  set(CNProc_SOURCE_DIR RTCP/CNProc)
+  set(SubSystems_SOURCE_DIR SubSystems)
+  set(CCU_MAC_SOURCE_DIR SubSystems/CCU_MAC)
+endif(NOT DEFINED LOFAR_PACKAGE_LIST_INCLUDED)
diff --git a/CMake/PythonInstall.cmake b/CMake/PythonInstall.cmake
index 1ea9c5eadfa..bd2c83e9458 100644
--- a/CMake/PythonInstall.cmake
+++ b/CMake/PythonInstall.cmake
@@ -19,11 +19,12 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
+# --------------------------------------------------------------------------
 # python_install(source1..sourceN DESTINATION install_dir)
 #
 # Install Python source files and byte-compile them in the directory
 # ${PYTHON_INSTALL_DIR}/${install_dir}.
-
+# --------------------------------------------------------------------------
 macro(python_install)
 
   # Precondition checks.
diff --git a/CMake/gen_LofarPackageList_cmake.sh b/CMake/gen_LofarPackageList_cmake.sh
new file mode 100755
index 00000000000..60fc4eb7b65
--- /dev/null
+++ b/CMake/gen_LofarPackageList_cmake.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+#  gen_LofarPackageList.cmake.sh: generate file LofarPackageList.cmake
+#
+#  Copyright (C) 2009
+#  ASTRON (Netherlands Foundation for Research in Astronomy)
+#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#  $Id$
+
+# This script generates the file LofarPackageList.cmake. This CMake file
+# initializes the <pkg>_SOURCE_DIR variables for each LOFAR package.
+
+
+# Get the LOFAR source directory root
+script_dir=$(cd $(dirname $0) && pwd)
+lofar_root=$(echo $script_dir | sed -e "s%\(.*/LOFAR\)/.*%\1%")
+
+# Just a safety net; this script must be inside the LOFAR tree.
+if test "$script_dir" = "$lofar_root"; then
+  echo "ERROR: $(basename $0) MUST be inside the LOFAR source tree!"
+  exit 1
+fi
+
+# Open the output file
+exec 3> $script_dir/LofarPackageList.cmake
+
+# Write header
+cat >&3 <<EOF
+#
+# Generated by $(basename $0) at $(date)
+#
+#                            ---- DO NOT EDIT ----
+#
+#  This file creates for each LOFAR package a cache variable containing the
+#  relative path to its source directory. Note that CMake also provides this
+#  information, but only AFTER a CMake project has been processed by
+#  CMake. However, sometimes we need this information BEFORE CMake has
+#  processed the directory. This file resolves this chicken-and-egg
+#  problem. 
+#
+#  ATTENTION: This file must be included BEFORE the first project() command is
+#  seen by CMake; either directly, or indirectly.
+#
+#  NOTE: This file must be kept up-to-date when project directories are added,
+#  moved, or deleted. Use $(basename $0) to do so.
+#
+EOF
+
+# Add a trailing slash to the directory path $lofar_root to ensure that, if
+# it is a symbolic link, it is translated to the directory it links to.
+for f in $(find $lofar_root/ -name CMakeLists.txt)
+do
+  # Search for the project() command, which looks like: project (MyProject ...)
+  p=$(sed -n 's,^[ \t]*project[ \t]*([ \t]*\([^ \t)]\+\).*$,\1,ip' $f)
+  if test "$p" != ""; then
+    d=$(dirname $f | sed -n "s%$lofar_root/%%p")
+    if test "$d" != ""; then
+      echo >&3 "set(${p}_SOURCE_DIR $d CACHE STATIC \"$p source directory\")"
+    fi
+  fi
+done
+
+# Close the output file
+exec 3>&-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7a03535de0..6e12a1a0e24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,32 +31,19 @@ include(LofarInit)
 project(LOFAR)
 include(LofarGeneral)
 
+include(LofarPackage)
+lofar_package(LOFAR)
+
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(LCS)
-lofar_add_subdirectory(CEP)
-lofar_add_subdirectory(RTCP)
-lofar_add_subdirectory(SAS)
-lofar_add_subdirectory(MAC)
+lofar_add_package(LCS)
+lofar_add_package(CEP)
+lofar_add_package(RTCP)
+lofar_add_package(SAS)
+lofar_add_package(MAC)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
 ## ---------------------------------------------------------------------------
 include(LofarConfig)
-
-get_directory_property(def DEFINITIONS)
-message(STATUS "COMPILE_DEFINITIONS = ${def}")
-
-if(0)
-  get_cmake_property(cache_vars CACHE_VARIABLES)
-  message(STATUS "vvvvvvvv Cache variables vvvvvvvv")
-  foreach(var ${cache_vars})
-    message(STATUS "[cached] ${var} = ${${var}}")
-  endforeach(var ${cache_vars})
-  message(STATUS "^^^^^^^^ Cache variables ^^^^^^^^")
-  message(STATUS "vvvvvvvv Variables vvvvvvvv")
-  include(AllVariables)
-  all_variables()
-  message(STATUS "^^^^^^^^ Variables ^^^^^^^^")
-endif(0)
diff --git a/LCS/ACC/ALC/CMakeLists.txt b/LCS/ACC/ALC/CMakeLists.txt
index 4961c604d0b..3917a650e36 100644
--- a/LCS/ACC/ALC/CMakeLists.txt
+++ b/LCS/ACC/ALC/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(ALC)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 2.1 DEPENDS Common Blob Transport)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 2.1 DEPENDS Common Blob Transport)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/ACC/CMakeLists.txt b/LCS/ACC/CMakeLists.txt
index c7e96f67629..3faf3b34fb8 100644
--- a/LCS/ACC/CMakeLists.txt
+++ b/LCS/ACC/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(ALC)
-lofar_add_subdirectory(PLC)
+lofar_add_package(ALC)
+lofar_add_package(PLC)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/LCS/ACC/PLC/CMakeLists.txt b/LCS/ACC/PLC/CMakeLists.txt
index c21a2c516cc..2c177fdd477 100644
--- a/LCS/ACC/PLC/CMakeLists.txt
+++ b/LCS/ACC/PLC/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(PLC)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 2.1 DEPENDS Common Blob Transport)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 2.1 DEPENDS Common Blob Transport)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/AMC/AMCBase/CMakeLists.txt b/LCS/AMC/AMCBase/CMakeLists.txt
index 6929520b094..def6b685688 100644
--- a/LCS/AMC/AMCBase/CMakeLists.txt
+++ b/LCS/AMC/AMCBase/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(AMCBase)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 2.0 DEPENDS Common Blob Transport)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 2.0 DEPENDS Common Blob Transport)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/AMC/AMCImpl/CMakeLists.txt b/LCS/AMC/AMCImpl/CMakeLists.txt
index 9b7ec92e10c..cfa2c77cf9c 100644
--- a/LCS/AMC/AMCImpl/CMakeLists.txt
+++ b/LCS/AMC/AMCImpl/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(AMCImpl)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 2.0 DEPENDS Common Transport AMCBase)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 2.0 DEPENDS Common Transport AMCBase)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/AMC/CMakeLists.txt b/LCS/AMC/CMakeLists.txt
index 96eb23c9146..35252848464 100644
--- a/LCS/AMC/CMakeLists.txt
+++ b/LCS/AMC/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(AMCBase)
-lofar_add_subdirectory(AMCImpl)
+lofar_add_package(AMCBase)
+lofar_add_package(AMCImpl)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/LCS/ApplCommon/CMakeLists.txt b/LCS/ApplCommon/CMakeLists.txt
index 2189d9333f8..c8ae975fc97 100644
--- a/LCS/ApplCommon/CMakeLists.txt
+++ b/LCS/ApplCommon/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(ApplCommon)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 3.1 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/Blob/CMakeLists.txt b/LCS/Blob/CMakeLists.txt
index e3961d6cb05..b0873cd028d 100644
--- a/LCS/Blob/CMakeLists.txt
+++ b/LCS/Blob/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Blob)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/CMakeLists.txt b/LCS/CMakeLists.txt
index fce1ff0f5fb..3ab5f313702 100644
--- a/LCS/CMakeLists.txt
+++ b/LCS/CMakeLists.txt
@@ -34,17 +34,16 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(Tools)          # Useful tools
-lofar_add_subdirectory(Common)         # Common stuff
-lofar_add_subdirectory(Blob)           # Binary Large Objects
-lofar_add_subdirectory(Stream)         # Low-level support for streaming data
-lofar_add_subdirectory(Transport)      # Low-level transport library
-lofar_add_subdirectory(ACC)            # Application Configuration & Control
-lofar_add_subdirectory(AMC)            # Astronomical Measures Conversions
-lofar_add_subdirectory(ApplCommon)     # Application common stuff
-
-lofar_add_subdirectory(pytools)        # Python tools
-lofar_add_subdirectory(pyparameterset) # Python ParameterSet bindings
+lofar_add_package(ACC)            # Application Configuration & Control
+lofar_add_package(AMC)            # Astronomical Measures Conversions
+lofar_add_package(ApplCommon)     # Application common stuff
+lofar_add_package(Blob)           # Binary Large Objects
+lofar_add_package(Common)         # Common stuff
+lofar_add_package(pyparameterset) # Python ParameterSet bindings
+lofar_add_package(pytools)        # Python tools
+lofar_add_package(Stream)         # Low-level support for streaming data
+lofar_add_package(Tools)          # Useful tools
+lofar_add_package(Transport)      # Low-level transport library
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/LCS/Common/CMakeLists.txt b/LCS/Common/CMakeLists.txt
index 2024e08eec8..c51eb15eee8 100644
--- a/LCS/Common/CMakeLists.txt
+++ b/LCS/Common/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Common)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 3.1)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 3.1)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/Stream/CMakeLists.txt b/LCS/Stream/CMakeLists.txt
index 340ec4a4edd..69090cb9b02 100644
--- a/LCS/Stream/CMakeLists.txt
+++ b/LCS/Stream/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Stream)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/Tools/CMakeLists.txt b/LCS/Tools/CMakeLists.txt
index 20686b251b1..9aa211c265c 100644
--- a/LCS/Tools/CMakeLists.txt
+++ b/LCS/Tools/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Tools)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.3)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.3)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration-specific header file
diff --git a/LCS/Transport/CMakeLists.txt b/LCS/Transport/CMakeLists.txt
index 3e091de4aa0..93d9256abcf 100644
--- a/LCS/Transport/CMakeLists.txt
+++ b/LCS/Transport/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Transport)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 2.3 DEPENDS Blob)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 2.3 DEPENDS Blob)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/LCS/pyparameterset/CMakeLists.txt b/LCS/pyparameterset/CMakeLists.txt
index 3b4ad0bf9e5..9edb8337e34 100644
--- a/LCS/pyparameterset/CMakeLists.txt
+++ b/LCS/pyparameterset/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(pyparameterset)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCS/pytools/CMakeLists.txt b/LCS/pytools/CMakeLists.txt
index ce86a86d581..a2e5d037d74 100644
--- a/LCS/pytools/CMakeLists.txt
+++ b/LCS/pytools/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(pytools NONE)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME})
+include(LofarPackage)
+lofar_package(${PROJECT_NAME})
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/LCU/CMakeLists.txt b/LCU/CMakeLists.txt
index 212704911f4..42339f92d99 100644
--- a/LCU/CMakeLists.txt
+++ b/LCU/CMakeLists.txt
@@ -33,5 +33,5 @@ project(LCU NONE)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(Firmware)
-lofar_add_subdirectory(StationTest)
+lofar_add_package(Firmware)
+lofar_add_package(StationTest)
diff --git a/LCU/Firmware/CMakeLists.txt b/LCU/Firmware/CMakeLists.txt
index c15c58f9275..0f9bf9be45a 100644
--- a/LCU/Firmware/CMakeLists.txt
+++ b/LCU/Firmware/CMakeLists.txt
@@ -33,4 +33,4 @@ project(Firmware NONE)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(tools)
+lofar_add_package(Firmware-Tools tools)
diff --git a/MAC/APL/APLCommon/CMakeLists.txt b/MAC/APL/APLCommon/CMakeLists.txt
index d5cd7c59306..edb435ac5fa 100644
--- a/MAC/APL/APLCommon/CMakeLists.txt
+++ b/MAC/APL/APLCommon/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(APLCommon)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common ApplCommon GCFTM MACIO)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 3.1 DEPENDS Common ApplCommon GCFTM MACIO)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/CEPCU/CMakeLists.txt b/MAC/APL/CEPCU/CMakeLists.txt
index 9363d7ce2b0..fc495dbafbc 100644
--- a/MAC/APL/CEPCU/CMakeLists.txt
+++ b/MAC/APL/CEPCU/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(CEPCU)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common ApplCommon ALC PLC MACIO GCFTM GCFRTDB APLCommon)
+lofar_package(${PROJECT_NAME} 3.1 DEPENDS Common ApplCommon ALC PLC MACIO GCFTM GCFRTDB APLCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/CMakeLists.txt b/MAC/APL/CMakeLists.txt
index 16ad4da5b72..d088e60509c 100644
--- a/MAC/APL/CMakeLists.txt
+++ b/MAC/APL/CMakeLists.txt
@@ -41,19 +41,19 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(APLCommon)     # Common tasks and functions
-lofar_add_subdirectory(RTCCommon)     # Real Time Control functions
-lofar_add_subdirectory(RTDBCommon)    # RealTimeDataBase common software
-lofar_add_subdirectory(TestSuite)     # 
-lofar_add_subdirectory(CUDaemons)     # Control Unit Daemons
-lofar_add_subdirectory(CURTDBDaemons) # Control Unit RTDB Daemons
-lofar_add_subdirectory(PIC)           # Physical Instrument Components (?)
-lofar_add_subdirectory(PAC)           # ???
-lofar_add_subdirectory(VHECR)         # VHECR related code
-lofar_add_subdirectory(CEPCU)         # CEP-related MAC controllers
-lofar_add_subdirectory(MainCU)        # Main Control Unit
-lofar_add_subdirectory(StationCU)     # Station Control Unit software
-lofar_add_subdirectory(TestCtlr)      # Testprograms for MAC controllers
+lofar_add_package(APLCommon)     # Common tasks and functions
+lofar_add_package(RTCCommon)     # Real Time Control functions
+lofar_add_package(RTDBCommon)    # RealTimeDataBase common software
+lofar_add_package(TestSuite)     # 
+lofar_add_package(CUDaemons)     # Control Unit Daemons
+lofar_add_package(CURTDBDaemons) # Control Unit RTDB Daemons
+lofar_add_package(PIC)           # Physical Instrument Components (?)
+lofar_add_package(PAC)           # ???
+lofar_add_package(VHECR)         # VHECR related code
+lofar_add_package(CEPCU)         # CEP-related MAC controllers
+lofar_add_package(MainCU)        # Main Control Unit
+lofar_add_package(StationCU)     # Station Control Unit software
+lofar_add_package(TestCtlr)      # Testprograms for MAC controllers
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/MAC/APL/CUDaemons/CMakeLists.txt b/MAC/APL/CUDaemons/CMakeLists.txt
index 7c3ab49b8fc..f201247a603 100644
--- a/MAC/APL/CUDaemons/CMakeLists.txt
+++ b/MAC/APL/CUDaemons/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(CUDaemons)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common ApplCommon APLCommon GCFTM MACIO)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common ApplCommon APLCommon GCFTM MACIO)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/CURTDBDaemons/CMakeLists.txt b/MAC/APL/CURTDBDaemons/CMakeLists.txt
index fc7c6c40c3f..c5d352eee7b 100644
--- a/MAC/APL/CURTDBDaemons/CMakeLists.txt
+++ b/MAC/APL/CURTDBDaemons/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(CURTDBDaemons)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common ApplCommon MACIO GCFTM GCFRTDB RTDBCommon APLCommon OTDB)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common ApplCommon MACIO GCFTM GCFRTDB RTDBCommon APLCommon OTDB)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/MD_Protocol/CMakeLists.txt b/MAC/APL/MD_Protocol/CMakeLists.txt
index 41ce4dc9a7e..2b1be9f42bc 100644
--- a/MAC/APL/MD_Protocol/CMakeLists.txt
+++ b/MAC/APL/MD_Protocol/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(MD_Protocol)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO RTCCommon)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO RTCCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/MainCU/CMakeLists.txt b/MAC/APL/MainCU/CMakeLists.txt
index 841192b1632..af69b3403c4 100644
--- a/MAC/APL/MainCU/CMakeLists.txt
+++ b/MAC/APL/MainCU/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(MainCU)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common OTDB MACIO GCFTM GCFPVSS GCFRTDB APLCommon RTDBCommon ApplCommon)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common OTDB MACIO GCFTM GCFPVSS GCFRTDB APLCommon RTDBCommon ApplCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PAC/BS_Protocol/CMakeLists.txt b/MAC/APL/PAC/BS_Protocol/CMakeLists.txt
index 119e35ac935..744330bb396 100644
--- a/MAC/APL/PAC/BS_Protocol/CMakeLists.txt
+++ b/MAC/APL/PAC/BS_Protocol/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(BS_Protocol)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common AMCBase MACIO RTCCommon RSP_Protocol)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common AMCBase MACIO RTCCommon RSP_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PAC/Beam_Server/CMakeLists.txt b/MAC/APL/PAC/Beam_Server/CMakeLists.txt
index 1728a85b917..346ec7d8e11 100644
--- a/MAC/APL/PAC/Beam_Server/CMakeLists.txt
+++ b/MAC/APL/PAC/Beam_Server/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(Beam_Server)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common AMCBase MACIO GCFTM TestSuite RTCCommon RSP_Protocol BS_Protocol CAL_Protocol)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common AMCBase MACIO GCFTM TestSuite RTCCommon RSP_Protocol BS_Protocol CAL_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PAC/CAL_Protocol/CMakeLists.txt b/MAC/APL/PAC/CAL_Protocol/CMakeLists.txt
index e70fbb39ceb..dafeb1e4a5f 100644
--- a/MAC/APL/PAC/CAL_Protocol/CMakeLists.txt
+++ b/MAC/APL/PAC/CAL_Protocol/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(CAL_Protocol)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO RTCCommon RSP_Protocol)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO RTCCommon RSP_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PAC/CMakeLists.txt b/MAC/APL/PAC/CMakeLists.txt
index 0fd6d55085f..83cb5141cac 100644
--- a/MAC/APL/PAC/CMakeLists.txt
+++ b/MAC/APL/PAC/CMakeLists.txt
@@ -34,11 +34,11 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(CAL_Protocol)
-lofar_add_subdirectory(BS_Protocol)
-lofar_add_subdirectory(Cal_Server)
-lofar_add_subdirectory(Beam_Server)
-lofar_add_subdirectory(SHMInfo_Server)
+lofar_add_package(CAL_Protocol)
+lofar_add_package(BS_Protocol)
+lofar_add_package(Cal_Server)
+lofar_add_package(Beam_Server)
+lofar_add_package(SHMInfo_Server)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/MAC/APL/PAC/Cal_Server/CMakeLists.txt b/MAC/APL/PAC/Cal_Server/CMakeLists.txt
index 7d86c46b2cb..c5ed69fb715 100644
--- a/MAC/APL/PAC/Cal_Server/CMakeLists.txt
+++ b/MAC/APL/PAC/Cal_Server/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(Cal_Server)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common AMCBase ApplCommon MACIO GCFTM TestSuite RTCCommon RSP_Protocol CAL_Protocol)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common AMCBase ApplCommon MACIO GCFTM TestSuite RTCCommon RSP_Protocol CAL_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PAC/SHMInfo_Server/CMakeLists.txt b/MAC/APL/PAC/SHMInfo_Server/CMakeLists.txt
index 7b3ec2b1d1f..e8e864a7d47 100644
--- a/MAC/APL/PAC/SHMInfo_Server/CMakeLists.txt
+++ b/MAC/APL/PAC/SHMInfo_Server/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(SHMInfo_Server)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO GCFTM GCFRTDB GCFPVSS RTCCommon RTDBCommon RSP_Protocol CAL_Protocol)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO GCFTM GCFRTDB GCFPVSS RTCCommon RTDBCommon RSP_Protocol CAL_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PIC/CMakeLists.txt b/MAC/APL/PIC/CMakeLists.txt
index 2fb32e9923b..2615848155d 100644
--- a/MAC/APL/PIC/CMakeLists.txt
+++ b/MAC/APL/PIC/CMakeLists.txt
@@ -34,10 +34,10 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(RSP_Protocol)
-lofar_add_subdirectory(TBB_Protocol)
-lofar_add_subdirectory(RSP_Driver)
-lofar_add_subdirectory(TBB_Driver)
+lofar_add_package(RSP_Protocol)
+lofar_add_package(TBB_Protocol)
+lofar_add_package(RSP_Driver)
+lofar_add_package(TBB_Driver)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/MAC/APL/PIC/RSP_Driver/CMakeLists.txt b/MAC/APL/PIC/RSP_Driver/CMakeLists.txt
index 8148bba852c..e52145f11f2 100644
--- a/MAC/APL/PIC/RSP_Driver/CMakeLists.txt
+++ b/MAC/APL/PIC/RSP_Driver/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(RSP_Driver)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common TestSuite GCFTM MACIO RTCCommon RSP_Protocol)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common TestSuite GCFTM MACIO RTCCommon RSP_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PIC/RSP_Protocol/CMakeLists.txt b/MAC/APL/PIC/RSP_Protocol/CMakeLists.txt
index af5e94e882b..3688cc3c93d 100644
--- a/MAC/APL/PIC/RSP_Protocol/CMakeLists.txt
+++ b/MAC/APL/PIC/RSP_Protocol/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(RSP_Protocol)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO RTCCommon)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common MACIO RTCCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PIC/TBB_Driver/CMakeLists.txt b/MAC/APL/PIC/TBB_Driver/CMakeLists.txt
index 93d88d00c57..a8dc8edd74c 100644
--- a/MAC/APL/PIC/TBB_Driver/CMakeLists.txt
+++ b/MAC/APL/PIC/TBB_Driver/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(TBB_Driver)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common TestSuite GCFTM MACIO RTCCommon TBB_Protocol)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common TestSuite GCFTM MACIO RTCCommon TBB_Protocol)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/PIC/TBB_Protocol/CMakeLists.txt b/MAC/APL/PIC/TBB_Protocol/CMakeLists.txt
index 4de52262b7c..adcd00e5c9e 100644
--- a/MAC/APL/PIC/TBB_Protocol/CMakeLists.txt
+++ b/MAC/APL/PIC/TBB_Protocol/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(TBB_Protocol)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS MACIO)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS MACIO)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/RTCCommon/CMakeLists.txt b/MAC/APL/RTCCommon/CMakeLists.txt
index b163d869278..67a2b90541a 100644
--- a/MAC/APL/RTCCommon/CMakeLists.txt
+++ b/MAC/APL/RTCCommon/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(RTCCommon)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 6.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 6.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/RTDBCommon/CMakeLists.txt b/MAC/APL/RTDBCommon/CMakeLists.txt
index b5e626b79e5..d46c295b22a 100644
--- a/MAC/APL/RTDBCommon/CMakeLists.txt
+++ b/MAC/APL/RTDBCommon/CMakeLists.txt
@@ -31,9 +31,9 @@ include(LofarInit)
 project(RTDBCommon)
 include(LofarGeneral)
 
-include(LofarAddPackage)
+include(LofarPackage)
 # Do not split the following line, otherwise makeversion will fail!
-lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common GCFPVSS GCFRTDB GCFTM MACIO)
+lofar_package(${PROJECT_NAME} 3.1 DEPENDS Common GCFPVSS GCFRTDB GCFTM MACIO)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/StationCU/CMakeLists.txt b/MAC/APL/StationCU/CMakeLists.txt
index 93a4b7c2dd4..8c92595d583 100644
--- a/MAC/APL/StationCU/CMakeLists.txt
+++ b/MAC/APL/StationCU/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(StationCU)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS 
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS 
   Common ApplCommon MACIO GCFTM GCFRTDB GCFPVSS APLCommon RTCCommon RTDBCommon
   BS_Protocol CAL_Protocol RSP_Protocol TBB_Protocol VHECR)
 
diff --git a/MAC/APL/TestCtlr/CMakeLists.txt b/MAC/APL/TestCtlr/CMakeLists.txt
index 20d5b54d55a..d98a0d4ef3b 100644
--- a/MAC/APL/TestCtlr/CMakeLists.txt
+++ b/MAC/APL/TestCtlr/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(TestCtlr)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common APLCommon MACIO GCFTM)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 3.1 DEPENDS Common APLCommon MACIO GCFTM)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/TestSuite/CMakeLists.txt b/MAC/APL/TestSuite/CMakeLists.txt
index 7879a3e09e7..e09fd864945 100644
--- a/MAC/APL/TestSuite/CMakeLists.txt
+++ b/MAC/APL/TestSuite/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(TestSuite)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/APL/VHECR/CMakeLists.txt b/MAC/APL/VHECR/CMakeLists.txt
index adee63ce457..6cab880f7a2 100644
--- a/MAC/APL/VHECR/CMakeLists.txt
+++ b/MAC/APL/VHECR/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(VHECR)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common )
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 3.1 DEPENDS Common )
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/CMakeLists.txt b/MAC/CMakeLists.txt
index c92c61a5240..980d4d5837c 100644
--- a/MAC/CMakeLists.txt
+++ b/MAC/CMakeLists.txt
@@ -34,12 +34,12 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(MACIO)       # MAC I/O related functions
-lofar_add_subdirectory(GCF)         # Generic Control Framework
-lofar_add_subdirectory(APL)         # Application subdirectory
-lofar_add_subdirectory(Deployment)  # Deployment related functions
-lofar_add_subdirectory(Navigator2)
-lofar_add_subdirectory(Tools)
+lofar_add_package(MACIO)       # MAC I/O related functions
+lofar_add_package(GCF)         # Generic Control Framework
+lofar_add_package(APL)         # Application subdirectory
+lofar_add_package(Deployment)  # Deployment related functions
+lofar_add_package(Navigator2)
+lofar_add_package(MACTools Tools)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/MAC/Deployment/CMakeLists.txt b/MAC/Deployment/CMakeLists.txt
index 2907565120e..7266f1cface 100644
--- a/MAC/Deployment/CMakeLists.txt
+++ b/MAC/Deployment/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Deployment)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common ApplCommon OTDB)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 0.1 DEPENDS Common ApplCommon OTDB)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/GCF/CMakeLists.txt b/MAC/GCF/CMakeLists.txt
index ba59ce31b7e..08dc8a11a2c 100644
--- a/MAC/GCF/CMakeLists.txt
+++ b/MAC/GCF/CMakeLists.txt
@@ -41,9 +41,9 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(TM)     # Task Management
-lofar_add_subdirectory(PVSS)   # Low-level interface to PVSS database
-lofar_add_subdirectory(RTDB)   # Real-Time Database layer.
+lofar_add_package(GCFTM   TM)     # Task Management
+lofar_add_package(GCFPVSS PVSS)   # Low-level interface to PVSS database
+lofar_add_package(GCFRTDB RTDB)   # Real-Time Database layer.
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/MAC/GCF/PVSS/CMakeLists.txt b/MAC/GCF/PVSS/CMakeLists.txt
index 4b691e35292..3a686652333 100644
--- a/MAC/GCF/PVSS/CMakeLists.txt
+++ b/MAC/GCF/PVSS/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(GCFPVSS)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common GCFTM)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common GCFTM)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/GCF/RTDB/CMakeLists.txt b/MAC/GCF/RTDB/CMakeLists.txt
index f53e0d38546..861485f6087 100644
--- a/MAC/GCF/RTDB/CMakeLists.txt
+++ b/MAC/GCF/RTDB/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(GCFRTDB)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common GCFPVSS GCFTM MACIO)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common GCFPVSS GCFTM MACIO)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/GCF/TM/CMakeLists.txt b/MAC/GCF/TM/CMakeLists.txt
index 477b274ce51..62a143cbeca 100644
--- a/MAC/GCF/TM/CMakeLists.txt
+++ b/MAC/GCF/TM/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(GCFTM)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 6.1 DEPENDS Common MACIO)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 6.1 DEPENDS Common MACIO)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/MACIO/CMakeLists.txt b/MAC/MACIO/CMakeLists.txt
index 18001bb59ef..d89db75a1ac 100644
--- a/MAC/MACIO/CMakeLists.txt
+++ b/MAC/MACIO/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(MACIO)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/Navigator2/CMakeLists.txt b/MAC/Navigator2/CMakeLists.txt
index c59ee02ee21..b902ec1e8b8 100644
--- a/MAC/Navigator2/CMakeLists.txt
+++ b/MAC/Navigator2/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Navigator2)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/MAC/Tools/CMakeLists.txt b/MAC/Tools/CMakeLists.txt
index ad2ef32a69c..84c215c37e8 100644
--- a/MAC/Tools/CMakeLists.txt
+++ b/MAC/Tools/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(MACTools)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/RTCP/CMakeLists.txt b/RTCP/CMakeLists.txt
index 30c727cdf7d..b4bb362484e 100644
--- a/RTCP/CMakeLists.txt
+++ b/RTCP/CMakeLists.txt
@@ -36,25 +36,25 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 
 # Defines interfaces between the different components within the RTCP product
-lofar_add_subdirectory(Interface)
+lofar_add_package(Interface)
 
 # Fast Collective Network Protocol; used on BlueGene only.
-lofar_add_subdirectory(FCNP)
+lofar_add_package(FCNP)
 
 # Compute-Node Processing: application running on the BlueGene compute nodes
-lofar_add_subdirectory(CNProc)
+lofar_add_package(CNProc)
 
 # I/O Node Processing: application running on the BlueGene I/O nodes
-lofar_add_subdirectory(IONProc)
+lofar_add_package(IONProc)
 
 # Stores output from the correlator in one or more MeasurmentSet files.
-lofar_add_subdirectory(Storage)
+lofar_add_package(Storage)
 
 # Several RTCP tools
-lofar_add_subdirectory(RTCPTools)
+lofar_add_package(RTCPTools)
 
 # Several run scripts to start the RTCP components
-lofar_add_subdirectory(Run)
+lofar_add_package(Run)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/RTCP/CNProc/CMakeLists.txt b/RTCP/CNProc/CMakeLists.txt
index 043420f6d80..926c1536432 100644
--- a/RTCP/CNProc/CMakeLists.txt
+++ b/RTCP/CNProc/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(CNProc)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common Stream Interface FCNP)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common Stream Interface FCNP)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/RTCP/FCNP/CMakeLists.txt b/RTCP/FCNP/CMakeLists.txt
index 3cf091d6c9c..bd3ac9c0e35 100644
--- a/RTCP/FCNP/CMakeLists.txt
+++ b/RTCP/FCNP/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(FCNP)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/RTCP/IONProc/CMakeLists.txt b/RTCP/IONProc/CMakeLists.txt
index 15027bb6a42..c66fb6726f0 100644
--- a/RTCP/IONProc/CMakeLists.txt
+++ b/RTCP/IONProc/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(IONProc)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0
   DEPENDS Common Stream AMCBase AMCImpl PLC Interface FCNP)
 
 ## ---------------------------------------------------------------------------
diff --git a/RTCP/Interface/CMakeLists.txt b/RTCP/Interface/CMakeLists.txt
index 26377d8834a..72c3de132e5 100644
--- a/RTCP/Interface/CMakeLists.txt
+++ b/RTCP/Interface/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Interface)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common Stream ApplCommon)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common Stream ApplCommon)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/RTCP/RTCPTools/CMakeLists.txt b/RTCP/RTCPTools/CMakeLists.txt
index 98ca0915177..7e36ca77be5 100644
--- a/RTCP/RTCPTools/CMakeLists.txt
+++ b/RTCP/RTCPTools/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(RTCPTools)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0)
 
 ## ---------------------------------------------------------------------------
 ## Subdirectories
diff --git a/RTCP/Storage/CMakeLists.txt b/RTCP/Storage/CMakeLists.txt
index 338206642a1..d4bdf4c0261 100644
--- a/RTCP/Storage/CMakeLists.txt
+++ b/RTCP/Storage/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(Storage)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common AMCBase Interface)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common AMCBase Interface)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/SAS/CMakeLists.txt b/SAS/CMakeLists.txt
index 32ac900db17..9ed0681f8f7 100644
--- a/SAS/CMakeLists.txt
+++ b/SAS/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(OTDB)
-lofar_add_subdirectory(OTB)
+lofar_add_package(OTDB)
+lofar_add_package(OTB)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/SAS/OTB/CMakeLists.txt b/SAS/OTB/CMakeLists.txt
index cef6c2f7deb..b4c58dedbb6 100644
--- a/SAS/OTB/CMakeLists.txt
+++ b/SAS/OTB/CMakeLists.txt
@@ -34,8 +34,8 @@ include(LofarGeneral)
 ## ---------------------------------------------------------------------------
 ## Subdirectories
 ## ---------------------------------------------------------------------------
-lofar_add_subdirectory(jOTDB2)
-lofar_add_subdirectory(OTB)
+lofar_add_package(jOTDB2)
+lofar_add_package(scripts)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/SAS/OTB/jOTDB2/CMakeLists.txt b/SAS/OTB/jOTDB2/CMakeLists.txt
index 1287947441d..02fb7bd03af 100644
--- a/SAS/OTB/jOTDB2/CMakeLists.txt
+++ b/SAS/OTB/jOTDB2/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(jOTDB2)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common OTDB)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common OTDB)
 
 ## ---------------------------------------------------------------------------
 ## External packages
diff --git a/SAS/OTDB/CMakeLists.txt b/SAS/OTDB/CMakeLists.txt
index 37fbb8b4f72..d997d3e1666 100644
--- a/SAS/OTDB/CMakeLists.txt
+++ b/SAS/OTDB/CMakeLists.txt
@@ -31,8 +31,8 @@ include(LofarInit)
 project(OTDB)
 include(LofarGeneral)
 
-include(LofarAddPackage)
-lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+include(LofarPackage)
+lofar_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 
 ## ---------------------------------------------------------------------------
 ## External packages
-- 
GitLab