mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-19 00:57:50 +08:00
68 lines
3.9 KiB
Diff
68 lines
3.9 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 2fb74b3..602e05d 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -64,26 +64,33 @@ include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${ssl_INCLUDE} )
|
||
|
# Build
|
||
|
#
|
||
|
file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" )
|
||
|
-
|
||
|
-set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" )
|
||
|
-add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} )
|
||
|
-set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 )
|
||
|
-set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON )
|
||
|
-set_target_properties( ${STATIC_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} )
|
||
|
-
|
||
|
-set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" )
|
||
|
-add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} )
|
||
|
-set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 )
|
||
|
-set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON )
|
||
|
-set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} )
|
||
|
-set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} )
|
||
|
+if(NOT BUILD_SHARED_LIBS)
|
||
|
+ set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" )
|
||
|
+ add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} )
|
||
|
+ set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 )
|
||
|
+ set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON )
|
||
|
+ set_target_properties( ${STATIC_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} )
|
||
|
+else()
|
||
|
+ set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" )
|
||
|
+ add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} )
|
||
|
+ set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 )
|
||
|
+ set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON )
|
||
|
+ set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} )
|
||
|
+ set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} )
|
||
|
+endif()
|
||
|
|
||
|
if ( BUILD_SSL )
|
||
|
- target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_SHARED} ${crypto_LIBRARY_SHARED} )
|
||
|
- target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_STATIC} ${crypto_LIBRARY_STATIC} ${CMAKE_DL_LIBS} )
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_SHARED} ${crypto_LIBRARY_SHARED} )
|
||
|
+ else()
|
||
|
+ target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_STATIC} ${crypto_LIBRARY_STATIC} ${CMAKE_DL_LIBS} )
|
||
|
+ endif()
|
||
|
else ( )
|
||
|
- target_link_libraries( ${SHARED_LIBRARY_NAME} )
|
||
|
- target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} )
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ target_link_libraries( ${SHARED_LIBRARY_NAME} )
|
||
|
+ else()
|
||
|
+ target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} )
|
||
|
+ endif()
|
||
|
endif ( )
|
||
|
|
||
|
if ( BUILD_TESTS )
|
||
|
@@ -103,5 +110,8 @@ file( GLOB ARTIFACTS "${SOURCE_DIR}/*.hpp" )
|
||
|
|
||
|
install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" )
|
||
|
install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" )
|
||
|
-install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
|
||
|
-install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
|
||
|
+if(NOT BUILD_SHARED_LIBS)
|
||
|
+ install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
|
||
|
+else()
|
||
|
+ install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library )
|
||
|
+endif()
|
||
|
\ No newline at end of file
|