Enable selection of static vs shared build

By removing the hard-coded `SHARED` flag in `ADD_LIBRARY` and setting the `ARCHIVE DESTINATION` to the library install path, you can choose which type of build you want by passing a `BUILD_SHARED_LIBS` flag when configuring.
This commit is contained in:
Kino 2020-04-26 03:59:44 +04:30 committed by GitHub
parent 692038ceaf
commit 992f1c56ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ IF(LIBNFC_LOG)
LIST(APPEND LIBRARY_SOURCES log log-internal)
ENDIF(WIN32)
ENDIF(LIBNFC_LOG)
ADD_LIBRARY(nfc SHARED ${LIBRARY_SOURCES})
ADD_LIBRARY(nfc ${LIBRARY_SOURCES})
IF(PCSC_FOUND)
TARGET_LINK_LIBRARIES(nfc ${PCSC_LIBRARIES})
@ -103,6 +103,6 @@ IF(WIN32)
# At compile time we need the .LIB file, we place it in the lib directory
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnfc.lib DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
ELSE(WIN32)
INSTALL(TARGETS nfc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
INSTALL(TARGETS nfc ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
ENDIF(WIN32)