mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +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:
parent
33e5a31ab7
commit
7b100a7f36
@ -47,7 +47,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Add serial library
|
## 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})
|
add_library(${PROJECT_NAME} ${serial_SRCS})
|
||||||
|
else()
|
||||||
|
add_library(${PROJECT_NAME} ${serial_SRCS})
|
||||||
|
add_library(${PROJECT_NAME}_static STATIC ${serial_SRCS})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user