blob: 4cbd1629e45741bcb3356f390b326dac894350f1 [file] [log] [blame]
hasufell3c6409b2014-03-06 15:49:08 +01001option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
2option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
Paul Bakker9d3a7e42011-01-05 15:24:43 +00003
4set(src
Paul Bakker396c52f2009-07-11 19:54:40 +00005 aes.c
Manuel Pégourié-Gonnard92ac76f2013-12-16 17:12:53 +01006 aesni.c
Paul Bakker367dae42009-06-28 21:50:27 +00007 arc4.c
Paul Bakkerefc30292011-11-10 14:43:23 +00008 asn1parse.c
Paul Bakkerbdb912d2012-02-13 23:11:30 +00009 asn1write.c
Paul Bakker396c52f2009-07-11 19:54:40 +000010 base64.c
11 bignum.c
Paul Bakkera9379c02012-07-04 11:02:11 +000012 blowfish.c
Paul Bakker396c52f2009-07-11 19:54:40 +000013 camellia.c
Manuel Pégourié-Gonnarda6916fa2014-05-02 15:17:29 +020014 ccm.c
Paul Bakker367dae42009-06-28 21:50:27 +000015 certs.c
Paul Bakker8123e9d2011-01-06 15:37:30 +000016 cipher.c
17 cipher_wrap.c
Paul Bakker0e04d0e2011-11-27 14:46:59 +000018 ctr_drbg.c
Paul Bakker396c52f2009-07-11 19:54:40 +000019 debug.c
20 des.c
Paul Bakker367dae42009-06-28 21:50:27 +000021 dhm.c
Manuel Pégourié-Gonnard39d2adb2012-10-31 09:26:55 +010022 ecp.c
Manuel Pégourié-Gonnard32b04c12013-12-02 15:49:09 +010023 ecp_curves.c
Manuel Pégourié-Gonnard0bad5c22013-01-26 15:30:46 +010024 ecdh.c
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010025 ecdsa.c
Paul Bakker6083fd22011-12-03 21:45:14 +000026 entropy.c
27 entropy_poll.c
Paul Bakker9d781402011-05-09 16:17:09 +000028 error.c
Paul Bakker89e80c92012-03-20 13:50:09 +000029 gcm.c
Paul Bakker396c52f2009-07-11 19:54:40 +000030 havege.c
Manuel Pégourié-Gonnard490bdf32014-01-27 14:03:10 +010031 hmac_drbg.c
Paul Bakker17373852011-01-06 14:20:01 +000032 md.c
33 md_wrap.c
Paul Bakker396c52f2009-07-11 19:54:40 +000034 md2.c
Paul Bakker367dae42009-06-28 21:50:27 +000035 md4.c
Paul Bakker396c52f2009-07-11 19:54:40 +000036 md5.c
Paul Bakker6e339b52013-07-03 13:37:05 +020037 memory_buffer_alloc.c
Paul Bakker396c52f2009-07-11 19:54:40 +000038 net.c
Paul Bakkerc70b9822013-04-07 22:00:46 +020039 oid.c
Paul Bakker396c52f2009-07-11 19:54:40 +000040 padlock.c
Paul Bakkerf518b162012-08-23 13:03:18 +000041 pbkdf2.c
Paul Bakker5a1494f2011-02-25 09:48:49 +000042 pem.c
Paul Bakkerb0c19a42013-06-24 19:26:38 +020043 pkcs5.c
Paul Bakkerb06819b2011-01-18 16:18:38 +000044 pkcs11.c
Paul Bakkerf1f21fe2013-06-24 19:17:19 +020045 pkcs12.c
Manuel Pégourié-Gonnard12e0ed92013-07-04 13:31:32 +020046 pk.c
Manuel Pégourié-Gonnardd73b3c12013-08-12 17:06:05 +020047 pk_wrap.c
Paul Bakker1a7550a2013-09-15 13:01:22 +020048 pkparse.c
Paul Bakkerc7bb02b2013-09-15 14:54:56 +020049 pkwrite.c
Paul Bakker747a83a2014-02-01 22:50:07 +010050 platform.c
Paul Bakker61b699e2014-01-22 13:35:29 +010051 ripemd160.c
Paul Bakker396c52f2009-07-11 19:54:40 +000052 rsa.c
53 sha1.c
Paul Bakkerd2681d82013-06-30 14:49:12 +020054 sha256.c
55 sha512.c
Paul Bakker0a597072012-09-25 21:55:46 +000056 ssl_cache.c
Paul Bakker68884e32013-01-07 18:20:04 +010057 ssl_ciphersuites.c
Paul Bakker7c6b2c32013-09-16 13:49:26 +020058 ssl_cli.c
59 ssl_srv.c
Paul Bakker396c52f2009-07-11 19:54:40 +000060 ssl_tls.c
Paul Bakker2466d932013-09-28 14:40:38 +020061 threading.c
Paul Bakker396c52f2009-07-11 19:54:40 +000062 timing.c
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000063 version.c
Paul Bakker0f90d7d2014-04-30 11:49:44 +020064 version_features.c
Paul Bakker7c6b2c32013-09-16 13:49:26 +020065 x509.c
66 x509_crt.c
67 x509_crl.c
68 x509_csr.c
69 x509_create.c
Paul Bakker9556d3d2013-09-18 13:50:13 +020070 x509write_crt.c
71 x509write_csr.c
Paul Bakker396c52f2009-07-11 19:54:40 +000072 xtea.c
Paul Bakker367dae42009-06-28 21:50:27 +000073)
Paul Bakker547f73d2011-01-05 15:07:54 +000074
Paul Bakker2a5c7a82012-05-10 21:54:28 +000075if(WIN32)
76set(libs ws2_32)
77endif(WIN32)
78
Paul Bakker76f03112013-11-28 17:20:04 +010079if(CMAKE_COMPILER_IS_GNUCC)
80 set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wmissing-declarations -Wmissing-prototypes")
81 set(CMAKE_C_FLAGS_CHECKFULL "${CMAKE_C_FLAGS_CHECK} -Wcast-qual")
82endif(CMAKE_COMPILER_IS_GNUCC)
83
hasufell3c6409b2014-03-06 15:49:08 +010084if (NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
85 message(FATAL_ERROR "Need to choose static or shared polarssl build!")
86endif(NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
Paul Bakker9d3a7e42011-01-05 15:24:43 +000087
hasufell3c6409b2014-03-06 15:49:08 +010088if(USE_STATIC_POLARSSL_LIBRARY AND USE_SHARED_POLARSSL_LIBRARY)
89 # if we build both static an shared, then let
90 # tests and programs link to the shared lib target
91 set(polarssl_static_target "polarssl_static")
92elseif(USE_STATIC_POLARSSL_LIBRARY)
93 set(polarssl_static_target "polarssl")
94endif()
Paul Bakker9d3a7e42011-01-05 15:24:43 +000095
hasufell3c6409b2014-03-06 15:49:08 +010096if(USE_STATIC_POLARSSL_LIBRARY)
97 add_library(${polarssl_static_target} STATIC ${src})
98 set_target_properties(${polarssl_static_target} PROPERTIES OUTPUT_NAME polarssl)
Paul Bakker6c1f69b2014-03-17 15:11:13 +010099 target_link_libraries(${polarssl_static_target} ${libs})
100
101 if(ZLIB_FOUND)
102 target_link_libraries(${polarssl_static_target} ${ZLIB_LIBRARIES})
103 endif(ZLIB_FOUND)
104
Paul Bakker9d3a7e42011-01-05 15:24:43 +0000105
hasufell3c6409b2014-03-06 15:49:08 +0100106 install(TARGETS ${polarssl_static_target}
107 DESTINATION ${LIB_INSTALL_DIR}
108 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
109endif()
Paul Bakker9d3a7e42011-01-05 15:24:43 +0000110
hasufell3c6409b2014-03-06 15:49:08 +0100111if(USE_SHARED_POLARSSL_LIBRARY)
112 add_library(polarssl SHARED ${src})
Paul Bakkerda130162014-05-01 14:27:19 +0200113 set_target_properties(polarssl PROPERTIES VERSION 1.3.7 SOVERSION 6)
Paul Bakker9d3a7e42011-01-05 15:24:43 +0000114
hasufell3c6409b2014-03-06 15:49:08 +0100115 target_link_libraries(polarssl ${libs})
Paul Bakker2a5c7a82012-05-10 21:54:28 +0000116
hasufell3c6409b2014-03-06 15:49:08 +0100117 if(ZLIB_FOUND)
118 target_link_libraries(polarssl ${ZLIB_LIBRARIES})
119 endif(ZLIB_FOUND)
Steffan Kargerc2458342013-11-14 10:34:46 +0100120
hasufell3c6409b2014-03-06 15:49:08 +0100121 install(TARGETS polarssl
122 DESTINATION ${LIB_INSTALL_DIR}
123 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
124endif(USE_SHARED_POLARSSL_LIBRARY)