mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-11 22:14:17 +01:00
CMake: Don't build non-crypto when a subproject
When building Mbed Crypto as a subproject, don't add targets for libmbedx509 or libmbedtls, as the parent project should build these. The parent project will define USE_CRYPTO_SUBMODULE variable when using Mbed Crypto as a submodule, so we can depend on that variable to control whether or not we build non-crypto libraries.
This commit is contained in:
parent
3a45d9e13b
commit
5ae1fb6f69
@ -147,17 +147,23 @@ if(USE_STATIC_MBEDTLS_LIBRARY)
|
||||
set_target_properties(${mbedcrypto_static_target} PROPERTIES OUTPUT_NAME mbedcrypto)
|
||||
target_link_libraries(${mbedcrypto_static_target} ${libs})
|
||||
|
||||
add_library(${mbedx509_static_target} STATIC ${src_x509})
|
||||
set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509)
|
||||
target_link_libraries(${mbedx509_static_target} ${libs} ${mbedcrypto_static_target})
|
||||
if(USE_CRYPTO_SUBMODULE)
|
||||
install(TARGETS ${mbedcrypto_static_target}
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
else()
|
||||
add_library(${mbedx509_static_target} STATIC ${src_x509})
|
||||
set_target_properties(${mbedx509_static_target} PROPERTIES OUTPUT_NAME mbedx509)
|
||||
target_link_libraries(${mbedx509_static_target} ${libs} ${mbedcrypto_static_target})
|
||||
|
||||
add_library(${mbedtls_static_target} STATIC ${src_tls})
|
||||
set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls)
|
||||
target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target})
|
||||
add_library(${mbedtls_static_target} STATIC ${src_tls})
|
||||
set_target_properties(${mbedtls_static_target} PROPERTIES OUTPUT_NAME mbedtls)
|
||||
target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target})
|
||||
|
||||
install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target}
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target}
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif()
|
||||
endif(USE_STATIC_MBEDTLS_LIBRARY)
|
||||
|
||||
if(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
@ -165,20 +171,33 @@ if(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
set_target_properties(mbedcrypto PROPERTIES VERSION 2.14.0 SOVERSION 3)
|
||||
target_link_libraries(mbedcrypto ${libs})
|
||||
|
||||
add_library(mbedx509 SHARED ${src_x509})
|
||||
set_target_properties(mbedx509 PROPERTIES VERSION 2.14.0 SOVERSION 0)
|
||||
target_link_libraries(mbedx509 ${libs} mbedcrypto)
|
||||
if(USE_CRYPTO_SUBMODULE)
|
||||
install(TARGETS mbedcrypto
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
else()
|
||||
add_library(mbedx509 SHARED ${src_x509})
|
||||
set_target_properties(mbedx509 PROPERTIES VERSION 2.14.0 SOVERSION 0)
|
||||
target_link_libraries(mbedx509 ${libs} mbedcrypto)
|
||||
|
||||
add_library(mbedtls SHARED ${src_tls})
|
||||
set_target_properties(mbedtls PROPERTIES VERSION 2.14.0 SOVERSION 12)
|
||||
target_link_libraries(mbedtls ${libs} mbedx509)
|
||||
add_library(mbedtls SHARED ${src_tls})
|
||||
set_target_properties(mbedtls PROPERTIES VERSION 2.14.0 SOVERSION 12)
|
||||
target_link_libraries(mbedtls ${libs} mbedx509)
|
||||
|
||||
install(TARGETS mbedtls mbedx509 mbedcrypto
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(TARGETS mbedtls mbedx509 mbedcrypto
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif()
|
||||
endif(USE_SHARED_MBEDTLS_LIBRARY)
|
||||
|
||||
add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls)
|
||||
if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
|
||||
add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static)
|
||||
if(USE_CRYPTO_SUBMODULE)
|
||||
add_custom_target(crypto_lib DEPENDS mbedcrypto)
|
||||
if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
|
||||
add_dependencies(crypto_lib mbedcrypto_static)
|
||||
endif()
|
||||
else()
|
||||
add_custom_target(lib DEPENDS mbedcrypto mbedx509 mbedtls)
|
||||
if(USE_STATIC_MBEDTLS_LIBRARY AND USE_SHARED_MBEDTLS_LIBRARY)
|
||||
add_dependencies(lib mbedcrypto_static mbedx509_static mbedtls_static)
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user