1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-23 04:04:54 +08:00

Cmake: Add BUILD_SHARED_LIBS option

As of now there is no way to make a static build of the library. This
adds a BUILD_SHARED_LIBS option to allow for only shared build or both
shared and static builds.
This commit is contained in:
Jesse 2021-08-22 13:59:48 -04:00 committed by Jesse Taube
parent 33e5a31ab7
commit 7b100a7f36

View File

@ -47,7 +47,15 @@ else()
endif()
## Add serial library
set(WJWSERIAL_BUILD_SHARED "ON" CACHE BOOL "Only build the shared version.")
if(WJWSERIAL_BUILD_SHARED)
add_library(${PROJECT_NAME} ${serial_SRCS})
else()
add_library(${PROJECT_NAME} ${serial_SRCS})
add_library(${PROJECT_NAME}_static STATIC ${serial_SRCS})
endif()
if(APPLE)
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif(UNIX)