2
1

polarssl-shared-and-static-library.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Allow both shared and static PolarSSL library
  2. By default, PolarSSL is built as a static library. If the option
  3. USE_SHARED_POLARSSL_LIBRARY is set, then it is build as a shared
  4. library. But there is no way of building both the shared and static
  5. versions.
  6. This patch adds the USE_STATIC_POLARSSL_LIBRARY (which defaults to ON)
  7. in addition to the existing USE_SHARED_POLARSSL_LIBRARY (which
  8. defaults to OFF). Both options can be manipulated independently.
  9. [Gustavo: update for polarssl 1.2.0]
  10. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  11. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  12. diff -Nura polarssl-1.2.0.orig/library/CMakeLists.txt polarssl-1.2.0/library/CMakeLists.txt
  13. --- polarssl-1.2.0.orig/library/CMakeLists.txt 2012-11-15 15:01:58.239248830 -0300
  14. +++ polarssl-1.2.0/library/CMakeLists.txt 2012-11-15 15:00:10.310806353 -0300
  15. @@ -1,4 +1,5 @@
  16. option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL as a shared library." OFF)
  17. +option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL as a static library." ON)
  18. set(src
  19. aes.c
  20. @@ -50,19 +51,23 @@
  21. set(libs ws2_32)
  22. endif(WIN32)
  23. -if(NOT USE_SHARED_POLARSSL_LIBRARY)
  24. -
  25. -add_library(polarssl STATIC ${src})
  26. -
  27. -else(NOT USE_SHARED_POLARSSL_LIBRARY)
  28. +if(USE_SHARED_POLARSSL_LIBRARY)
  29. add_library(polarssl SHARED ${src})
  30. set_target_properties(polarssl PROPERTIES VERSION 1.2.0 SOVERSION 2)
  31. +set_target_properties(polarssl PROPERTIES OUTPUT_NAME polarssl)
  32. +
  33. +endif(USE_SHARED_POLARSSL_LIBRARY)
  34. +
  35. +if(USE_STATIC_POLARSSL_LIBRARY)
  36. +
  37. +add_library(polarssl-static STATIC ${src})
  38. +set_target_properties(polarssl-static PROPERTIES OUTPUT_NAME polarssl)
  39. -endif(NOT USE_SHARED_POLARSSL_LIBRARY)
  40. +endif(USE_STATIC_POLARSSL_LIBRARY)
  41. target_link_libraries(polarssl ${libs})
  42. -install(TARGETS polarssl
  43. +install(TARGETS polarssl polarssl-static
  44. DESTINATION ${LIB_INSTALL_DIR}
  45. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)