CMakeLists.txt 2.82 KB
Newer Older
1 2
option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
3 4

set(src
5
     aes.c
6
     aesni.c
7
     arc4.c
8
     asn1parse.c
9
     asn1write.c
10 11
     base64.c
     bignum.c
12
     blowfish.c
13
     camellia.c
14
     certs.c
15 16
     cipher.c
     cipher_wrap.c
17
     ctr_drbg.c
18 19
     debug.c
     des.c
20
     dhm.c
21
     ecp.c
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
22
     ecp_curves.c
23
     ecdh.c
24
     ecdsa.c
25 26
     entropy.c
     entropy_poll.c
27
     error.c
28
     gcm.c
29
     havege.c
30
     hmac_drbg.c
31 32
     md.c
     md_wrap.c
33
     md2.c
34
     md4.c
35
     md5.c
36
     memory_buffer_alloc.c
37
     net.c
38
     oid.c
39
     padlock.c
40
     pbkdf2.c
Paul Bakker's avatar
Paul Bakker committed
41
     pem.c
42
     pkcs5.c
43
     pkcs11.c
44
     pkcs12.c
45
     pk.c
46
     pk_wrap.c
47
     pkparse.c
48
     pkwrite.c
49
     platform.c
Paul Bakker's avatar
Paul Bakker committed
50
     ripemd160.c
51 52
     rsa.c
     sha1.c
53 54
     sha256.c
     sha512.c
55
     ssl_cache.c
56
     ssl_ciphersuites.c
57 58
     ssl_cli.c
     ssl_srv.c
59
     ssl_tls.c
60
     threading.c
61
     timing.c
62
     version.c
63 64 65 66 67
     x509.c
     x509_crt.c
     x509_crl.c
     x509_csr.c
     x509_create.c
68 69
     x509write_crt.c
     x509write_csr.c
70
     xtea.c
71
)
72

73 74 75 76
if(WIN32)
set(libs ws2_32)
endif(WIN32)

77 78 79 80 81
if(CMAKE_COMPILER_IS_GNUCC)
  set(CMAKE_C_FLAGS_CHECK "${CMAKE_C_FLAGS_CHECK} -Wmissing-declarations -Wmissing-prototypes")
  set(CMAKE_C_FLAGS_CHECKFULL "${CMAKE_C_FLAGS_CHECK} -Wcast-qual")
endif(CMAKE_COMPILER_IS_GNUCC)

82 83 84
if (NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
	message(FATAL_ERROR "Need to choose static or shared polarssl build!")
endif(NOT USE_STATIC_POLARSSL_LIBRARY AND NOT USE_SHARED_POLARSSL_LIBRARY)
85

86 87 88 89 90 91 92
if(USE_STATIC_POLARSSL_LIBRARY AND USE_SHARED_POLARSSL_LIBRARY)
	# if we build both static an shared, then let
	# tests and programs link to the shared lib target
	set(polarssl_static_target "polarssl_static")
elseif(USE_STATIC_POLARSSL_LIBRARY)
	set(polarssl_static_target "polarssl")
endif()
93

94 95 96
if(USE_STATIC_POLARSSL_LIBRARY)
	add_library(${polarssl_static_target} STATIC ${src})
	set_target_properties(${polarssl_static_target} PROPERTIES OUTPUT_NAME polarssl)
97 98 99 100 101 102
	target_link_libraries(${polarssl_static_target} ${libs})

	if(ZLIB_FOUND)
		target_link_libraries(${polarssl_static_target} ${ZLIB_LIBRARIES})
	endif(ZLIB_FOUND)

103

104 105 106 107
	install(TARGETS ${polarssl_static_target}
			DESTINATION ${LIB_INSTALL_DIR}
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
108

109 110
if(USE_SHARED_POLARSSL_LIBRARY)
	add_library(polarssl SHARED ${src})
Paul Bakker's avatar
Paul Bakker committed
111
	set_target_properties(polarssl PROPERTIES VERSION 1.3.6 SOVERSION 6)
112

113
	target_link_libraries(polarssl ${libs})
114

115 116 117
	if(ZLIB_FOUND)
		target_link_libraries(polarssl ${ZLIB_LIBRARIES})
	endif(ZLIB_FOUND)
118

119 120 121 122
	install(TARGETS polarssl
			DESTINATION ${LIB_INSTALL_DIR}
			PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif(USE_SHARED_POLARSSL_LIBRARY)