Check if the targets already exist

`CGALConfig.cmake` is guarded, but it might be that the targets are
already defined by a sub-directory.
This commit is contained in:
Laurent Rineau 2016-09-15 17:45:14 +02:00
parent 97352da979
commit a27beba41c
1 changed files with 4 additions and 2 deletions

View File

@ -73,9 +73,11 @@ endforeach()
# Define the CGAL targets and theirs CGAL:: aliases # Define the CGAL targets and theirs CGAL:: aliases
# #
foreach(cgal_lib CGAL CGAL_Core CGAL_ImageIO CGAL_Qt5) 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_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() endif()
endforeach() endforeach()