blob: 86ccee19ed149605084d06d546ddc6d71dd38bbf [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
Paul Bakker367dae42009-06-28 21:50:27 +000014 certs.c
Paul Bakker8123e9d2011-01-06 15:37:30 +000015 cipher.c
16 cipher_wrap.c
Paul Bakker0e04d0e2011-11-27 14:46:59 +000017 ctr_drbg.c
Paul Bakker396c52f2009-07-11 19:54:40 +000018 debug.c
19 des.c
Paul Bakker367dae42009-06-28 21:50:27 +000020 dhm.c
Manuel Pégourié-Gonnard39d2adb2012-10-31 09:26:55 +010021 ecp.c
Manuel Pégourié-Gonnard32b04c12013-12-02 15:49:09 +010022 ecp_curves.c
Manuel Pégourié-Gonnard0bad5c22013-01-26 15:30:46 +010023 ecdh.c
Manuel Pégourié-Gonnard2aea1412013-01-26 16:33:44 +010024 ecdsa.c
Paul Bakker6083fd22011-12-03 21:45:14 +000025 entropy.c
26 entropy_poll.c
Paul Bakker9d781402011-05-09 16:17:09 +000027 error.c
Paul Bakker89e80c92012-03-20 13:50:09 +000028 gcm.c
Paul Bakker396c52f2009-07-11 19:54:40 +000029 havege.c
Manuel Pégourié-Gonnard490bdf32014-01-27 14:03:10 +010030 hmac_drbg.c
Paul Bakker17373852011-01-06 14:20:01 +000031 md.c
32 md_wrap.c
Paul Bakker396c52f2009-07-11 19:54:40 +000033 md2.c
Paul Bakker367dae42009-06-28 21:50:27 +000034 md4.c
Paul Bakker396c52f2009-07-11 19:54:40 +000035 md5.c
Paul Bakker6e339b52013-07-03 13:37:05 +020036 memory_buffer_alloc.c
Paul Bakker396c52f2009-07-11 19:54:40 +000037 net.c
Paul Bakkerc70b9822013-04-07 22:00:46 +020038 oid.c
Paul Bakker396c52f2009-07-11 19:54:40 +000039 padlock.c
Paul Bakkerf518b162012-08-23 13:03:18 +000040 pbkdf2.c
Paul Bakker5a1494f2011-02-25 09:48:49 +000041 pem.c
Paul Bakkerb0c19a42013-06-24 19:26:38 +020042 pkcs5.c
Paul Bakkerb06819b2011-01-18 16:18:38 +000043 pkcs11.c
Paul Bakkerf1f21fe2013-06-24 19:17:19 +020044 pkcs12.c
Manuel Pégourié-Gonnard12e0ed92013-07-04 13:31:32 +020045 pk.c
Manuel Pégourié-Gonnardd73b3c12013-08-12 17:06:05 +020046 pk_wrap.c
Paul Bakker1a7550a2013-09-15 13:01:22 +020047 pkparse.c
Paul Bakkerc7bb02b2013-09-15 14:54:56 +020048 pkwrite.c
Paul Bakker747a83a2014-02-01 22:50:07 +010049 platform.c
Paul Bakker61b699e2014-01-22 13:35:29 +010050 ripemd160.c
Paul Bakker396c52f2009-07-11 19:54:40 +000051 rsa.c
52 sha1.c
Paul Bakkerd2681d82013-06-30 14:49:12 +020053 sha256.c
54 sha512.c
Paul Bakker0a597072012-09-25 21:55:46 +000055 ssl_cache.c
Paul Bakker68884e32013-01-07 18:20:04 +010056 ssl_ciphersuites.c
Paul Bakker7c6b2c32013-09-16 13:49:26 +020057 ssl_cli.c
58 ssl_srv.c
Paul Bakker396c52f2009-07-11 19:54:40 +000059 ssl_tls.c
Paul Bakker2466d932013-09-28 14:40:38 +020060 threading.c
Paul Bakker396c52f2009-07-11 19:54:40 +000061 timing.c
Paul Bakker3ac1b2d2010-06-18 22:47:29 +000062 version.c
Paul Bakker0f90d7d2014-04-30 11:49:44 +020063 version_features.c
Paul Bakker7c6b2c32013-09-16 13:49:26 +020064 x509.c
65 x509_crt.c
66 x509_crl.c
67 x509_csr.c
68 x509_create.c
Paul Bakker9556d3d2013-09-18 13:50:13 +020069 x509write_crt.c
70 x509write_csr.c
Paul Bakker396c52f2009-07-11 19:54:40 +000071 xtea.c
Paul Bakker367dae42009-06-28 21:50:27 +000072)
Paul Bakker547f73d2011-01-05 15:07:54 +000073
Paul Bakker2a5c7a82012-05-10 21:54:28 +000074if(WIN32)
75set(libs ws2_32)
76endif(WIN32)
77
Paul Bakker76f03112013-11-28 17:20:04 +010078if(CMAKE_COMPILER_IS_GNUCC)
79 set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wmissing-declarations -Wmissing-prototypes")
80 set(CMAKE_C_FLAGS_CHECKFULL "${CMAKE_C_FLAGS_CHECK} -Wcast-qual")
81endif(CMAKE_COMPILER_IS_GNUCC)
82
hasufell3c6409b2014-03-06 15:49:08 +010083if (NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
84 message(FATAL_ERROR "Need to choose static or shared polarssl build!")
85endif(NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
Paul Bakker9d3a7e42011-01-05 15:24:43 +000086
hasufell3c6409b2014-03-06 15:49:08 +010087if(USE_STATIC_POLARSSL_LIBRARY AND USE_SHARED_POLARSSL_LIBRARY)
88 # if we build both static an shared, then let
89 # tests and programs link to the shared lib target
90 set(polarssl_static_target "polarssl_static")
91elseif(USE_STATIC_POLARSSL_LIBRARY)
92 set(polarssl_static_target "polarssl")
93endif()
Paul Bakker9d3a7e42011-01-05 15:24:43 +000094
hasufell3c6409b2014-03-06 15:49:08 +010095if(USE_STATIC_POLARSSL_LIBRARY)
96 add_library(${polarssl_static_target} STATIC ${src})
97 set_target_properties(${polarssl_static_target} PROPERTIES OUTPUT_NAME polarssl)
Paul Bakker6c1f69b2014-03-17 15:11:13 +010098 target_link_libraries(${polarssl_static_target} ${libs})
99
100 if(ZLIB_FOUND)
101 target_link_libraries(${polarssl_static_target} ${ZLIB_LIBRARIES})
102 endif(ZLIB_FOUND)
103
Paul Bakker9d3a7e42011-01-05 15:24:43 +0000104
hasufell3c6409b2014-03-06 15:49:08 +0100105 install(TARGETS ${polarssl_static_target}
106 DESTINATION ${LIB_INSTALL_DIR}
107 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
108endif()
Paul Bakker9d3a7e42011-01-05 15:24:43 +0000109
hasufell3c6409b2014-03-06 15:49:08 +0100110if(USE_SHARED_POLARSSL_LIBRARY)
111 add_library(polarssl SHARED ${src})
Paul Bakkerda130162014-05-01 14:27:19 +0200112 set_target_properties(polarssl PROPERTIES VERSION 1.3.7 SOVERSION 6)
Paul Bakker9d3a7e42011-01-05 15:24:43 +0000113
hasufell3c6409b2014-03-06 15:49:08 +0100114 target_link_libraries(polarssl ${libs})
Paul Bakker2a5c7a82012-05-10 21:54:28 +0000115
hasufell3c6409b2014-03-06 15:49:08 +0100116 if(ZLIB_FOUND)
117 target_link_libraries(polarssl ${ZLIB_LIBRARIES})
118 endif(ZLIB_FOUND)
Steffan Kargerc2458342013-11-14 10:34:46 +0100119
hasufell3c6409b2014-03-06 15:49:08 +0100120 install(TARGETS polarssl
121 DESTINATION ${LIB_INSTALL_DIR}
122 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
123endif(USE_SHARED_POLARSSL_LIBRARY)