mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
option(LIBIPC_BUILD_SHARED_LIBS 'Build shared libraries (DLLs).' OFF)
This commit is contained in:
parent
57e5298006
commit
cca4664e84
@ -44,9 +44,11 @@
|
||||
*/
|
||||
|
||||
#ifndef IPC_EXPORT
|
||||
#if defined(__IPC_LIBRARY__)
|
||||
#if defined(LIBIPC_LIBRARY_SHARED_BUILDING__)
|
||||
# define IPC_EXPORT IPC_DECL_EXPORT
|
||||
#else
|
||||
#elif defined(LIBIPC_LIBRARY_SHARED_USING__)
|
||||
# define IPC_EXPORT IPC_DECL_IMPORT
|
||||
#else
|
||||
# define IPC_EXPORT
|
||||
#endif
|
||||
#endif /*IPC_EXPORT*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
project(ipc)
|
||||
|
||||
add_compile_options(-D__IPC_LIBRARY__)
|
||||
option(LIBIPC_BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_compile_options(-fPIC)
|
||||
@ -26,7 +26,17 @@ file(GLOB HEAD_FILES
|
||||
${LIBIPC_PROJECT_DIR}/src/libipc/platform/*.h
|
||||
${LIBIPC_PROJECT_DIR}/src/libipc/utility/*.h)
|
||||
|
||||
if (LIBIPC_BUILD_SHARED_LIBS)
|
||||
add_library(${PROJECT_NAME} SHARED ${SRC_FILES} ${HEAD_FILES})
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
INTERFACE
|
||||
LIBIPC_LIBRARY_SHARED_USING__
|
||||
PRIVATE
|
||||
LIBIPC_LIBRARY_SHARED_BUILDING__)
|
||||
else()
|
||||
add_library(${PROJECT_NAME} STATIC ${SRC_FILES} ${HEAD_FILES})
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||
pthread
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user