From 1ccffb57b5cf8fd4cc23ec7df7bcf87f4129700c Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Sun, 16 Aug 2015 20:58:43 +0000
Subject: [PATCH] Task #8021: Changed CMakeLists.txt file to make use of new
 lofar_create_target_symlink() macro. Added <PACKAGE_NAME> to the name of the
 target created by lofar_create_target_symlink() to avoid multiple definitions
 of the same target across different packages.

---
 CEP/MS/test/CMakeLists.txt                 | 10 ++++------
 CEP/ParmDB/test/CMakeLists.txt             | 10 ++++------
 CEP/pyparmdb/test/CMakeLists.txt           |  5 ++---
 CMake/LofarMacros.cmake                    |  4 ++--
 RTCP/Cobalt/CobaltTest/test/CMakeLists.txt |  6 ++----
 5 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/CEP/MS/test/CMakeLists.txt b/CEP/MS/test/CMakeLists.txt
index e78b99e1b3e..fed5c8da22a 100644
--- a/CEP/MS/test/CMakeLists.txt
+++ b/CEP/MS/test/CMakeLists.txt
@@ -3,13 +3,11 @@
 include(LofarCTest)
 
 # Create symbolic links to scripts used by the tmakems test script.
-get_target_property(_loc getparsetvalue LOCATION)
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-  ${_loc}
+lofar_create_target_symlink(
+  getparsetvalue 
   ${CMAKE_CURRENT_BINARY_DIR}/getparsetvalue)
-get_target_property(_loc finddproc LOCATION)
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-  ${_loc}
+lofar_create_target_symlink(
+  finddproc 
   ${CMAKE_CURRENT_BINARY_DIR}/finddproc)
 execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
   ${LMWCommon_SOURCE_DIR}/src/startdistproc
diff --git a/CEP/ParmDB/test/CMakeLists.txt b/CEP/ParmDB/test/CMakeLists.txt
index 3b0477c1689..b161005a2f3 100644
--- a/CEP/ParmDB/test/CMakeLists.txt
+++ b/CEP/ParmDB/test/CMakeLists.txt
@@ -3,13 +3,11 @@
 include(LofarCTest)
 
 # Create symbolic links to scripts used by some of the test programs
-get_target_property(_loc getparsetvalue LOCATION)
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-  ${_loc}
+lofar_create_target_symlink(
+  getparsetvalue 
   ${CMAKE_CURRENT_BINARY_DIR}/getparsetvalue)
-get_target_property(_loc finddproc LOCATION)
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-  ${_loc}
+lofar_create_target_symlink(
+  finddproc 
   ${CMAKE_CURRENT_BINARY_DIR}/finddproc)
 execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
   ${LMWCommon_SOURCE_DIR}/src/startdistproc
diff --git a/CEP/pyparmdb/test/CMakeLists.txt b/CEP/pyparmdb/test/CMakeLists.txt
index a1899ef713a..81a127052e6 100644
--- a/CEP/pyparmdb/test/CMakeLists.txt
+++ b/CEP/pyparmdb/test/CMakeLists.txt
@@ -4,9 +4,8 @@ include(LofarCTest)
 
 # We need to create a symlink to the parmdbm executable in the current
 # binary directory, so that the test program(s) can find it.
-get_target_property(_parmdbm parmdbm LOCATION_${CMAKE_BUILD_TYPE})
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-  ${_parmdbm}
+lofar_create_target_symlink(
+  parmdbm
   ${CMAKE_CURRENT_BINARY_DIR}/parmdbm)
 
 lofar_add_test(tpyparmdb DEPENDS parmdbm _parmdb)
diff --git a/CMake/LofarMacros.cmake b/CMake/LofarMacros.cmake
index 811d454eb9e..0c6efabf453 100644
--- a/CMake/LofarMacros.cmake
+++ b/CMake/LofarMacros.cmake
@@ -184,11 +184,11 @@ if(NOT DEFINED LOFAR_MACROS_INCLUDED)
     else(POLICY CMP0026)
       get_target_property(_location ${_target} LOCATION)
     endif(POLICY CMP0026)
-    add_custom_target(${_target}_symlink ALL
+    add_custom_target(${PACKAGE_NAME}_${_target}_symlink ALL
       COMMAND ${CMAKE_COMMAND} -E create_symlink
       ${_location}
       ${_symlink})
-    add_dependencies(${_target}_symlink ${_target})
+    add_dependencies(${PACKAGE_NAME}_${_target}_symlink ${_target})
   endmacro(lofar_create_target_symlink _target _symlink)
 
 
diff --git a/RTCP/Cobalt/CobaltTest/test/CMakeLists.txt b/RTCP/Cobalt/CobaltTest/test/CMakeLists.txt
index 060158b9e2a..61ec8cddeeb 100644
--- a/RTCP/Cobalt/CobaltTest/test/CMakeLists.txt
+++ b/RTCP/Cobalt/CobaltTest/test/CMakeLists.txt
@@ -3,9 +3,8 @@
 include(LofarCTest)
 
 # Create symbolic link to the outputProc executable used by the tests below.
-get_target_property(_loc outputProc LOCATION)
-execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-  ${_loc}
+lofar_create_target_symlink(
+  outputProc
   ${CMAKE_CURRENT_BINARY_DIR}/outputProc)
 
 foreach(_test tMultiPartTABOutput tManyPartTABOutput)
@@ -15,4 +14,3 @@ foreach(_test tMultiPartTABOutput tManyPartTABOutput)
       PROPERTIES ENVIRONMENT "LOFARROOT=${GPUProc_SOURCE_DIR}")
   endif(BUILD_TESTING)
 endforeach()
-
-- 
GitLab