From 992f1c56ca7663357911c24843834a88ef98d8dc Mon Sep 17 00:00:00 2001 From: Kino Date: Sun, 26 Apr 2020 03:59:44 +0430 Subject: [PATCH] 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. --- libnfc/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libnfc/CMakeLists.txt b/libnfc/CMakeLists.txt index 79bab5dc..e90f591a 100644 --- a/libnfc/CMakeLists.txt +++ b/libnfc/CMakeLists.txt @@ -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)