From a27beba41c86c9993d30200a74d8eb37a4ca5b58 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 15 Sep 2016 17:45:14 +0200 Subject: [PATCH] Check if the targets already exist `CGALConfig.cmake` is guarded, but it might be that the targets are already defined by a sub-directory. --- Installation/lib/cmake/CGAL/CGALConfig.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index e1b462471e0..fb49e4a6fd2 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -73,9 +73,11 @@ endforeach() # Define the CGAL targets and theirs CGAL:: aliases # foreach(cgal_lib CGAL CGAL_Core CGAL_ImageIO CGAL_Qt5) - if(${cgal_lib}_FOUND) + if(${cgal_lib}_FOUND AND NOT TARGET ${cgal_lib}) add_library(${cgal_lib} INTERFACE) - add_library(CGAL::${cgal_lib} ALIAS ${cgal_lib}) + if(NOT TARGET CGAL::${cgal_lib}) + add_library(CGAL::${cgal_lib} ALIAS ${cgal_lib}) + endif() endif() endforeach()