cmake: add imported target for QtSingleApplication

This simplifies cmake code a bit: we remove if's and just generate
different target (imported or alias) with the same name and use it
unconditionally.
This commit is contained in:
Eugene Shalygin 2016-04-17 01:07:15 +02:00 committed by sledgehammer999
commit cba9d222de
5 changed files with 22 additions and 11 deletions

View file

@ -79,3 +79,15 @@ ELSE (QTSINGLEAPPLICATION_FOUND)
ENDIF (QTSINGLEAPPLICATION_FOUND)
MARK_AS_ADVANCED(QTSINGLEAPPLICATION_INCLUDE_DIR QTSINGLEAPPLICATION_LIBRARY)
if(NOT TARGET QtSingleApplication::QtSingleApplication)
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
)
if(EXISTS "${QTSINGLEAPPLICATION_LIBRARY}")
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${QTSINGLEAPPLICATION_LIBRARY}")
endif()
endif(NOT TARGET QtSingleApplication::QtSingleApplication)