blob: e11cab3f5992f7810d7ddb2bdcff5b70a0572847 [file] [log] [blame]
Allow both shared and static PolarSSL library
By default, PolarSSL is built as a static library. If the option
USE_SHARED_POLARSSL_LIBRARY is set, then it is build as a shared
library. But there is no way of building both the shared and static
versions.
This patch adds the USE_STATIC_POLARSSL_LIBRARY (which defaults to ON)
in addition to the existing USE_SHARED_POLARSSL_LIBRARY (which
defaults to OFF). Both options can be manipulated independently.
[Gustavo: update for polarssl 1.2.0]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
diff -Nura polarssl-1.2.0.orig/library/CMakeLists.txt polarssl-1.2.0/library/CMakeLists.txt
--- polarssl-1.2.0.orig/library/CMakeLists.txt 2012-11-15 15:01:58.239248830 -0300
+++ polarssl-1.2.0/library/CMakeLists.txt 2012-11-15 15:00:10.310806353 -0300
@@ -1,4 +1,5 @@
option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL as a shared library." OFF)
+option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL as a static library." ON)
set(src
aes.c
@@ -50,19 +51,23 @@
set(libs ws2_32)
endif(WIN32)
-if(NOT USE_SHARED_POLARSSL_LIBRARY)
-
-add_library(polarssl STATIC ${src})
-
-else(NOT USE_SHARED_POLARSSL_LIBRARY)
+if(USE_SHARED_POLARSSL_LIBRARY)
add_library(polarssl SHARED ${src})
set_target_properties(polarssl PROPERTIES VERSION 1.2.0 SOVERSION 2)
+set_target_properties(polarssl PROPERTIES OUTPUT_NAME polarssl)
+
+endif(USE_SHARED_POLARSSL_LIBRARY)
+
+if(USE_STATIC_POLARSSL_LIBRARY)
+
+add_library(polarssl-static STATIC ${src})
+set_target_properties(polarssl-static PROPERTIES OUTPUT_NAME polarssl)
-endif(NOT USE_SHARED_POLARSSL_LIBRARY)
+endif(USE_STATIC_POLARSSL_LIBRARY)
target_link_libraries(polarssl ${libs})
-install(TARGETS polarssl
+install(TARGETS polarssl polarssl-static
DESTINATION ${LIB_INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)