From 2b8ee5a82dbe95f6947b141a296208d26885f09a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 10 Jan 2018 16:25:48 +0100 Subject: [PATCH] changed: check for existing target before importing to aid use of a super project for opm --- cmake/Templates/opm-project-config.cmake.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/Templates/opm-project-config.cmake.in b/cmake/Templates/opm-project-config.cmake.in index ccc982536..331910810 100644 --- a/cmake/Templates/opm-project-config.cmake.in +++ b/cmake/Templates/opm-project-config.cmake.in @@ -41,8 +41,10 @@ if(NOT @opm-project_NAME@_FOUND) if (NOT "@opm-project_TARGET@" STREQUAL "") # add the library as a target, so that other things in the project including # this file may depend on it and get rebuild if this library changes. - add_library (@opm-project_TARGET@ UNKNOWN IMPORTED) - set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}") + if(NOT TARGET @opm-project_TARGET@) + add_library (@opm-project_TARGET@ UNKNOWN IMPORTED) + set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}") + endif() endif (NOT "@opm-project_TARGET@" STREQUAL "") # ensure that we build with support for C++11 to preserve ABI