cmake: install shared library only if it was requested

$ cmake -DEVENT__LIBRARY_TYPE=static ..
  ...
  CMake Error:
  Error evaluating generator expression:

    $<TARGET_FILE_DIR:event_core_shared>

  No target "event_core_shared"

Fixes: #853
Fixes: 669a53f3 ("cmake: set library names to be the same as with autotools")
(cherry picked from commit 55d1e20e1a5dbd1188f4143968f7cafee33edc0d)
This commit is contained in:
Azat Khuzhin 2019-07-12 00:00:12 +03:00 committed by Azat Khuzhin
parent 9559349cbc
commit 596855f7af
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

View File

@ -149,7 +149,7 @@ macro(add_event_library LIB_NAME)
PUBLIC_HEADER DESTINATION "include/event2" PUBLIC_HEADER DESTINATION "include/event2"
COMPONENT dev COMPONENT dev
) )
if (NOT WIN32) if (NOT WIN32 AND ${EVENT_LIBRARY_SHARED})
install(FILES install(FILES
"$<TARGET_FILE_DIR:${LIB_NAME}_shared>/${LIB_LINK_NAME}" "$<TARGET_FILE_DIR:${LIB_NAME}_shared>/${LIB_LINK_NAME}"
DESTINATION "lib" DESTINATION "lib"