mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-25 03:37:55 +08:00
85 lines
3.0 KiB
Diff
85 lines
3.0 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index f92363e..b0becbb 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -196,27 +196,28 @@ IF (MSGPACK_ENABLE_SHARED)
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
ENDIF ()
|
|
+IF (MSGPACK_ENABLE_STATIC)
|
|
+ ADD_LIBRARY (msgpackc-static STATIC
|
|
+ ${msgpackc_SOURCES}
|
|
+ ${msgpackc_HEADERS}
|
|
+ )
|
|
|
|
-ADD_LIBRARY (msgpackc-static STATIC
|
|
- ${msgpackc_SOURCES}
|
|
- ${msgpackc_HEADERS}
|
|
-)
|
|
-
|
|
-TARGET_INCLUDE_DIRECTORIES (msgpackc-static
|
|
- PUBLIC
|
|
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
|
- $<INSTALL_INTERFACE:include>
|
|
- PRIVATE
|
|
- ${CMAKE_CURRENT_SOURCE_DIR}
|
|
-)
|
|
+ TARGET_INCLUDE_DIRECTORIES (msgpackc-static
|
|
+ PUBLIC
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
|
+ $<INSTALL_INTERFACE:include>
|
|
+ PRIVATE
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}
|
|
+ )
|
|
+ SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc" COMPILE_DEFINITIONS MSGPACK_DLLEXPORT=)
|
|
+ENDIF ()
|
|
|
|
-IF (NOT MSGPACK_ENABLE_SHARED)
|
|
+IF (MSGPACK_ENABLE_STATIC AND NOT MSGPACK_ENABLE_SHARED)
|
|
# Add alias for subdirectories
|
|
ADD_LIBRARY (msgpackc ALIAS msgpackc-static)
|
|
ENDIF ()
|
|
|
|
-SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
|
|
IF (MSGPACK_ENABLE_SHARED)
|
|
IF (MSVC)
|
|
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX "_import.lib")
|
|
@@ -239,14 +240,18 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" ST
|
|
IF (MSGPACK_ENABLE_SHARED)
|
|
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3 -DPIC")
|
|
ENDIF ()
|
|
- SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
|
|
+ IF (MSGPACK_ENABLE_STATIC)
|
|
+ SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Werror -g -O3" )
|
|
+ ENDIF ()
|
|
ENDIF ()
|
|
|
|
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
IF (MSGPACK_ENABLE_SHARED)
|
|
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
|
ENDIF ()
|
|
- SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
|
+ IF (MSGPACK_ENABLE_STATIC)
|
|
+ SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
|
+ ENDIF ()
|
|
ENDIF ()
|
|
|
|
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
@@ -278,10 +283,12 @@ IF (MSGPACK_BUILD_EXAMPLES)
|
|
ADD_SUBDIRECTORY (example)
|
|
ENDIF ()
|
|
|
|
-IF (MSGPACK_ENABLE_SHARED)
|
|
+IF (MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_STATIC)
|
|
SET (MSGPACK_INSTALLTARGETS msgpackc msgpackc-static)
|
|
-ELSE()
|
|
+ELSEIF (MSGPACK_ENABLE_STATIC)
|
|
SET (MSGPACK_INSTALLTARGETS msgpackc-static)
|
|
+ELSE ()
|
|
+ SET (MSGPACK_INSTALLTARGETS msgpackc)
|
|
ENDIF ()
|
|
|
|
INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-targets
|