mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 11:45:42 +01:00
cmake: adjust libraries linking
This commit is contained in:
parent
c8293b20a9
commit
ba2c8763b6
@ -86,10 +86,6 @@ set(src
|
||||
${src_tls}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(libs ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes")
|
||||
endif(CMAKE_COMPILER_IS_GNUCC)
|
||||
@ -98,13 +94,27 @@ if(CMAKE_COMPILER_IS_CLANG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code")
|
||||
endif(CMAKE_COMPILER_IS_CLANG)
|
||||
|
||||
if(WIN32)
|
||||
set(libs ${libs} ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
if(USE_PKCS11_HELPER_LIBRARY)
|
||||
set(libs ${libs} pkcs11-helper)
|
||||
endif(USE_PKCS11_HELPER_LIBRARY)
|
||||
|
||||
if(ENABLE_ZLIB_SUPPORT)
|
||||
set(libs ${libs} ${ZLIB_LIBRARIES})
|
||||
endif(ENABLE_ZLIB_SUPPORT)
|
||||
|
||||
if(LINK_WITH_PTHREAD)
|
||||
set(libs ${libs} pthread)
|
||||
endif()
|
||||
|
||||
if (NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY)
|
||||
message(FATAL_ERROR "Need to choose static or shared mbedtls build!")
|
||||
endif(NOT USE_STATIC_MBEDTLS_LIBRARY AND NOT USE_SHARED_MBEDTLS_LIBRARY)
|
||||
|
||||
if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
|
||||
# if we build both static an shared, then let
|
||||
# tests and programs link to the shared lib target
|
||||
set(mbedtls_static_target "mbedtls_static")
|
||||
elseif(USE_STATIC_MBEDTLS_LIBRARY)
|
||||
set(mbedtls_static_target "mbedtls")
|
||||
@ -115,33 +125,16 @@ if(USE_STATIC_MBEDTLS_LIBRARY)
|
||||
set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls)
|
||||
target_link_libraries(${mbedtls_static_target} ${libs})
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
target_link_libraries(${mbedtls_static_target} ${ZLIB_LIBRARIES})
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
if(LINK_WITH_PTHREAD)
|
||||
target_link_libraries(${mbedtls_static_target} pthread)
|
||||
endif()
|
||||
|
||||
install(TARGETS ${mbedtls_static_target}
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif()
|
||||
|
||||
if(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
add_library(mbedtls SHARED ${src})
|
||||
set_target_properties(mbedtls PROPERTIES VERSION 1.4.0 SOVERSION 8)
|
||||
|
||||
target_link_libraries(mbedtls ${libs})
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
target_link_libraries(mbedtls ${ZLIB_LIBRARIES})
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
if(LINK_WITH_PTHREAD)
|
||||
target_link_libraries(mbedtls pthread)
|
||||
endif()
|
||||
|
||||
install(TARGETS mbedtls
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
Loading…
Reference in New Issue
Block a user