changed: check for existing target before importing

to aid use of a super project for opm
This commit is contained in:
Arne Morten Kvarving
2018-01-10 16:25:48 +01:00
parent 4e9f15dec3
commit 2b8ee5a82d

View File

@@ -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