diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | apps/ocspcheck/CMakeLists.txt | 2 | ||||
-rw-r--r-- | apps/openssl/CMakeLists.txt | 2 | ||||
-rw-r--r-- | crypto/CMakeLists.txt | 111 | ||||
-rw-r--r-- | ssl/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tls/CMakeLists.txt | 30 |
6 files changed, 63 insertions, 90 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ac3e5a0..32b5b15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -413,11 +413,11 @@ set(LIBTLS_LIBS tls ${PLATFORM_LIBS}) | |||
413 | 413 | ||
414 | # libraries for regression test | 414 | # libraries for regression test |
415 | if(BUILD_SHARED_LIBS) | 415 | if(BUILD_SHARED_LIBS) |
416 | set(OPENSSL_TEST_LIBS ssl-static crypto-static ${PLATFORM_LIBS}) | 416 | set(OPENSSL_TEST_LIBS ssl-static crypto-static ${PLATFORM_LIBS} compat_obj) |
417 | set(LIBTLS_TEST_LIBS tls-static ${OPENSSL_TEST_LIBS}) | 417 | set(LIBTLS_TEST_LIBS tls-static ${OPENSSL_TEST_LIBS}) |
418 | else() | 418 | else() |
419 | set(OPENSSL_TEST_LIBS ssl crypto ${PLATFORM_LIBS}) | 419 | set(OPENSSL_TEST_LIBS ssl crypto ${PLATFORM_LIBS} compat_obj) |
420 | set(LIBTLS_TEST_LIBS tls ${PLATFORM_LIBS}) | 420 | set(LIBTLS_TEST_LIBS tls ${PLATFORM_LIBS} compat_obj) |
421 | endif() | 421 | endif() |
422 | 422 | ||
423 | if(OPENSSLDIR STREQUAL "") | 423 | if(OPENSSLDIR STREQUAL "") |
diff --git a/apps/ocspcheck/CMakeLists.txt b/apps/ocspcheck/CMakeLists.txt index 41c7845..778e837 100644 --- a/apps/ocspcheck/CMakeLists.txt +++ b/apps/ocspcheck/CMakeLists.txt | |||
@@ -20,7 +20,7 @@ target_include_directories(ocspcheck | |||
20 | PUBLIC | 20 | PUBLIC |
21 | ../../include | 21 | ../../include |
22 | ${CMAKE_BINARY_DIR}/include) | 22 | ${CMAKE_BINARY_DIR}/include) |
23 | target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) | 23 | target_link_libraries(ocspcheck tls ${OPENSSL_LIBS} compat_obj tls_compat_obj) |
24 | 24 | ||
25 | if(ENABLE_LIBRESSL_INSTALL) | 25 | if(ENABLE_LIBRESSL_INSTALL) |
26 | install(TARGETS ocspcheck DESTINATION ${CMAKE_INSTALL_BINDIR}) | 26 | install(TARGETS ocspcheck DESTINATION ${CMAKE_INSTALL_BINDIR}) |
diff --git a/apps/openssl/CMakeLists.txt b/apps/openssl/CMakeLists.txt index efea217..f2dcf97 100644 --- a/apps/openssl/CMakeLists.txt +++ b/apps/openssl/CMakeLists.txt | |||
@@ -75,7 +75,7 @@ target_include_directories(openssl | |||
75 | PUBLIC | 75 | PUBLIC |
76 | ../../include | 76 | ../../include |
77 | ${CMAKE_BINARY_DIR}/include) | 77 | ${CMAKE_BINARY_DIR}/include) |
78 | target_link_libraries(openssl ${OPENSSL_LIBS}) | 78 | target_link_libraries(openssl ${OPENSSL_LIBS} compat_obj) |
79 | 79 | ||
80 | if(ENABLE_LIBRESSL_INSTALL) | 80 | if(ENABLE_LIBRESSL_INSTALL) |
81 | install(TARGETS openssl DESTINATION ${CMAKE_INSTALL_BINDIR}) | 81 | install(TARGETS openssl DESTINATION ${CMAKE_INSTALL_BINDIR}) |
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 8046efe..496d64b 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
@@ -734,6 +734,8 @@ set( | |||
734 | x509/x_all.c | 734 | x509/x_all.c |
735 | ) | 735 | ) |
736 | 736 | ||
737 | set(COMPAT_SRC "") | ||
738 | |||
737 | if(UNIX) | 739 | if(UNIX) |
738 | set(CRYPTO_SRC ${CRYPTO_SRC} crypto_lock.c) | 740 | set(CRYPTO_SRC ${CRYPTO_SRC} crypto_lock.c) |
739 | set(CRYPTO_SRC ${CRYPTO_SRC} bio/b_posix.c) | 741 | set(CRYPTO_SRC ${CRYPTO_SRC} bio/b_posix.c) |
@@ -749,38 +751,19 @@ if(WIN32) | |||
749 | endif() | 751 | endif() |
750 | 752 | ||
751 | if(WIN32) | 753 | if(WIN32) |
752 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/posix_win.c) | 754 | set(COMPAT_SRC ${COMPAT_SRC} compat/posix_win.c) |
753 | set(EXTRA_EXPORT ${EXTRA_EXPORT} gettimeofday) | ||
754 | set(EXTRA_EXPORT ${EXTRA_EXPORT} getuid) | ||
755 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_perror) | ||
756 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_fopen) | ||
757 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_fgets) | ||
758 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_open) | ||
759 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_rename) | ||
760 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_connect) | ||
761 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_close) | ||
762 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_read) | ||
763 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_write) | ||
764 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_getsockopt) | ||
765 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_setsockopt) | ||
766 | endif() | 755 | endif() |
767 | 756 | ||
768 | if(NOT HAVE_ASPRINTF) | 757 | if(NOT HAVE_ASPRINTF) |
769 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/bsd-asprintf.c) | 758 | set(COMPAT_SRC ${COMPAT_SRC} compat/bsd-asprintf.c) |
770 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_asprintf) | ||
771 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_vasprintf) | ||
772 | endif() | 759 | endif() |
773 | 760 | ||
774 | if(NOT HAVE_FREEZERO) | 761 | if(NOT HAVE_FREEZERO) |
775 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/freezero.c) | 762 | set(COMPAT_SRC ${COMPAT_SRC} compat/freezero.c) |
776 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_freezero) | ||
777 | endif() | 763 | endif() |
778 | 764 | ||
779 | if(NOT HAVE_GETOPT) | 765 | if(NOT HAVE_GETOPT) |
780 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getopt_long.c) | 766 | set(COMPAT_SRC ${COMPAT_SRC} compat/getopt_long.c) |
781 | set(EXTRA_EXPORT ${EXTRA_EXPORT} getopt) | ||
782 | set(EXTRA_EXPORT ${EXTRA_EXPORT} optarg) | ||
783 | set(EXTRA_EXPORT ${EXTRA_EXPORT} optind) | ||
784 | endif() | 767 | endif() |
785 | 768 | ||
786 | if(NOT HAVE_GETPAGESIZE) | 769 | if(NOT HAVE_GETPAGESIZE) |
@@ -798,47 +781,38 @@ if(NOT HAVE_GETPROGNAME) | |||
798 | endif() | 781 | endif() |
799 | 782 | ||
800 | if(NOT HAVE_REALLOCARRAY) | 783 | if(NOT HAVE_REALLOCARRAY) |
801 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/reallocarray.c) | 784 | set(COMPAT_SRC ${COMPAT_SRC} compat/reallocarray.c) |
802 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_reallocarray) | ||
803 | endif() | 785 | endif() |
804 | 786 | ||
805 | if(NOT HAVE_RECALLOCARRAY) | 787 | if(NOT HAVE_RECALLOCARRAY) |
806 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/recallocarray.c) | 788 | set(COMPAT_SRC ${COMPAT_SRC} compat/recallocarray.c) |
807 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_recallocarray) | ||
808 | endif() | 789 | endif() |
809 | 790 | ||
810 | if(NOT HAVE_STRCASECMP) | 791 | if(NOT HAVE_STRCASECMP) |
811 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c) | 792 | set(COMPAT_SRC ${COMPAT_SRC} compat/strcasecmp.c) |
812 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strcasecmp) | ||
813 | endif() | 793 | endif() |
814 | 794 | ||
815 | if(NOT HAVE_STRLCAT) | 795 | if(NOT HAVE_STRLCAT) |
816 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcat.c) | 796 | set(COMPAT_SRC ${COMPAT_SRC} compat/strlcat.c) |
817 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strlcat) | ||
818 | endif() | 797 | endif() |
819 | 798 | ||
820 | if(NOT HAVE_STRLCPY) | 799 | if(NOT HAVE_STRLCPY) |
821 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strlcpy.c) | 800 | set(COMPAT_SRC ${COMPAT_SRC} compat/strlcpy.c) |
822 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strlcpy) | ||
823 | endif() | 801 | endif() |
824 | 802 | ||
825 | if(NOT HAVE_STRNDUP) | 803 | if(NOT HAVE_STRNDUP) |
826 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strndup.c) | 804 | set(COMPAT_SRC ${COMPAT_SRC} compat/strndup.c) |
827 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strndup) | ||
828 | if(NOT HAVE_STRNLEN) | 805 | if(NOT HAVE_STRNLEN) |
829 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strnlen.c) | 806 | set(COMPAT_SRC ${COMPAT_SRC} compat/strnlen.c) |
830 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strnlen) | ||
831 | endif() | 807 | endif() |
832 | endif() | 808 | endif() |
833 | 809 | ||
834 | if(NOT HAVE_STRSEP) | 810 | if(NOT HAVE_STRSEP) |
835 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strsep.c) | 811 | set(COMPAT_SRC ${COMPAT_SRC} compat/strsep.c) |
836 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strsep) | ||
837 | endif() | 812 | endif() |
838 | 813 | ||
839 | if(NOT HAVE_STRTONUM) | 814 | if(NOT HAVE_STRTONUM) |
840 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strtonum.c) | 815 | set(COMPAT_SRC ${COMPAT_SRC} compat/strtonum.c) |
841 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_strtonum) | ||
842 | endif() | 816 | endif() |
843 | 817 | ||
844 | if(NOT HAVE_SYSLOG_R) | 818 | if(NOT HAVE_SYSLOG_R) |
@@ -846,57 +820,49 @@ if(NOT HAVE_SYSLOG_R) | |||
846 | endif() | 820 | endif() |
847 | 821 | ||
848 | if(NOT HAVE_TIMEGM) | 822 | if(NOT HAVE_TIMEGM) |
849 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/timegm.c) | 823 | set(COMPAT_SRC ${COMPAT_SRC} compat/timegm.c) |
850 | set(EXTRA_EXPORT ${EXTRA_EXPORT} timegm) | ||
851 | endif() | 824 | endif() |
852 | 825 | ||
853 | if(NOT HAVE_EXPLICIT_BZERO) | 826 | if(NOT HAVE_EXPLICIT_BZERO) |
854 | if(WIN32) | 827 | if(WIN32) |
855 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero_win.c) | 828 | set(COMPAT_SRC ${COMPAT_SRC} compat/explicit_bzero_win.c) |
856 | else() | 829 | else() |
857 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/explicit_bzero.c) | 830 | set(COMPAT_SRC ${COMPAT_SRC} compat/explicit_bzero.c) |
858 | set_source_files_properties(compat/explicit_bzero.c PROPERTIES COMPILE_FLAGS -O0) | 831 | set_source_files_properties(compat/explicit_bzero.c PROPERTIES COMPILE_FLAGS -O0) |
859 | endif() | 832 | endif() |
860 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_explicit_bzero) | ||
861 | endif() | 833 | endif() |
862 | 834 | ||
863 | if(NOT HAVE_ARC4RANDOM_BUF) | 835 | if(NOT HAVE_ARC4RANDOM_BUF) |
864 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/arc4random.c) | 836 | set(COMPAT_SRC ${COMPAT_SRC} compat/arc4random.c) |
865 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/arc4random_uniform.c) | 837 | set(COMPAT_SRC ${COMPAT_SRC} compat/arc4random_uniform.c) |
866 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_arc4random) | ||
867 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_arc4random_buf) | ||
868 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_arc4random_uniform) | ||
869 | 838 | ||
870 | if(NOT HAVE_GETENTROPY) | 839 | if(NOT HAVE_GETENTROPY) |
871 | if(WIN32) | 840 | if(WIN32) |
872 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_win.c) | 841 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_win.c) |
873 | elseif(CMAKE_SYSTEM_NAME MATCHES "AIX") | 842 | elseif(CMAKE_SYSTEM_NAME MATCHES "AIX") |
874 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_aix.c) | 843 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_aix.c) |
875 | elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") | 844 | elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
876 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_freebsd.c) | 845 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_freebsd.c) |
877 | elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX") | 846 | elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX") |
878 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_hpux.c) | 847 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_hpux.c) |
879 | elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") | 848 | elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") |
880 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_linux.c) | 849 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_linux.c) |
881 | elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") | 850 | elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") |
882 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_netbsd.c) | 851 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_netbsd.c) |
883 | elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") | 852 | elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") |
884 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_osx.c) | 853 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_osx.c) |
885 | elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") | 854 | elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") |
886 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getentropy_solaris.c) | 855 | set(COMPAT_SRC ${COMPAT_SRC} compat/getentropy_solaris.c) |
887 | endif() | 856 | endif() |
888 | set(EXTRA_EXPORT ${EXTRA_EXPORT} getentropy) | ||
889 | endif() | 857 | endif() |
890 | endif() | 858 | endif() |
891 | 859 | ||
892 | if(NOT HAVE_TIMINGSAFE_BCMP) | 860 | if(NOT HAVE_TIMINGSAFE_BCMP) |
893 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_bcmp.c) | 861 | set(COMPAT_SRC ${COMPAT_SRC} compat/timingsafe_bcmp.c) |
894 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_timingsafe_bcmp) | ||
895 | endif() | 862 | endif() |
896 | 863 | ||
897 | if(NOT HAVE_TIMINGSAFE_MEMCMP) | 864 | if(NOT HAVE_TIMINGSAFE_MEMCMP) |
898 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_memcmp.c) | 865 | set(COMPAT_SRC ${COMPAT_SRC} compat/timingsafe_memcmp.c) |
899 | set(EXTRA_EXPORT ${EXTRA_EXPORT} libressl_timingsafe_memcmp) | ||
900 | endif() | 866 | endif() |
901 | 867 | ||
902 | if(NOT ENABLE_ASM) | 868 | if(NOT ENABLE_ASM) |
@@ -919,15 +885,14 @@ foreach(SYM IN LISTS CRYPTO_UNEXPORT) | |||
919 | string(REPLACE "${SYM}\n" "" SYMS ${SYMS}) | 885 | string(REPLACE "${SYM}\n" "" SYMS ${SYMS}) |
920 | endforeach() | 886 | endforeach() |
921 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym ${SYMS}) | 887 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym ${SYMS}) |
922 | # XXX should we still be doing this? | ||
923 | if(EXTRA_EXPORT) | ||
924 | list(SORT EXTRA_EXPORT) | ||
925 | foreach(SYM IN LISTS EXTRA_EXPORT) | ||
926 | file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym "${SYM}\n") | ||
927 | endforeach() | ||
928 | endif() | ||
929 | 888 | ||
930 | set(LIBTLS_EXTRA_EXPORT ${EXTRA_EXPORT} PARENT_SCOPE) | 889 | add_library(compat_obj OBJECT ${COMPAT_SRC}) |
890 | target_include_directories(compat_obj | ||
891 | PRIVATE | ||
892 | ../include/compat | ||
893 | PUBLIC | ||
894 | ../include | ||
895 | ${CMAKE_BINARY_DIR}/include) | ||
931 | 896 | ||
932 | add_library(crypto_obj OBJECT ${CRYPTO_SRC}) | 897 | add_library(crypto_obj OBJECT ${CRYPTO_SRC}) |
933 | target_include_directories(crypto_obj | 898 | target_include_directories(crypto_obj |
@@ -977,7 +942,7 @@ elseif(HOST_X86_64) | |||
977 | target_include_directories(crypto_obj PRIVATE bn/arch/amd64) | 942 | target_include_directories(crypto_obj PRIVATE bn/arch/amd64) |
978 | endif() | 943 | endif() |
979 | 944 | ||
980 | add_library(crypto $<TARGET_OBJECTS:crypto_obj> empty.c) | 945 | add_library(crypto $<TARGET_OBJECTS:crypto_obj> $<TARGET_OBJECTS:compat_obj> empty.c) |
981 | 946 | ||
982 | export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) | 947 | export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) |
983 | target_link_libraries(crypto ${PLATFORM_LIBS}) | 948 | target_link_libraries(crypto ${PLATFORM_LIBS}) |
diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index 22385ba..9be9e99 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt | |||
@@ -78,7 +78,7 @@ target_include_directories(bs_obj | |||
78 | ../include/compat) | 78 | ../include/compat) |
79 | 79 | ||
80 | if(BUILD_SHARED_LIBS) | 80 | if(BUILD_SHARED_LIBS) |
81 | add_library(ssl $<TARGET_OBJECTS:ssl_obj> $<TARGET_OBJECTS:bs_obj>) | 81 | add_library(ssl $<TARGET_OBJECTS:ssl_obj> $<TARGET_OBJECTS:compat_obj> $<TARGET_OBJECTS:bs_obj>) |
82 | else() | 82 | else() |
83 | add_library(ssl $<TARGET_OBJECTS:ssl_obj> empty.c) | 83 | add_library(ssl $<TARGET_OBJECTS:ssl_obj> empty.c) |
84 | endif() | 84 | endif() |
diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt index c3c9424..33ae184 100644 --- a/tls/CMakeLists.txt +++ b/tls/CMakeLists.txt | |||
@@ -14,28 +14,32 @@ set( | |||
14 | tls_verify.c | 14 | tls_verify.c |
15 | ) | 15 | ) |
16 | 16 | ||
17 | set(TLS_COMPAT_SRC "") | ||
18 | |||
17 | if(WIN32) | 19 | if(WIN32) |
18 | set( | 20 | set( |
19 | TLS_SRC | 21 | TLS_SRC |
20 | ${TLS_SRC} | 22 | ${TLS_SRC} |
21 | compat/ftruncate.c | ||
22 | compat/pread.c | ||
23 | compat/pwrite.c | ||
24 | ) | 23 | ) |
25 | 24 | ||
26 | set(LIBTLS_EXTRA_EXPORT ${LIBTLS_EXTRA_EXPORT} ftruncate) | 25 | set(TLS_COMPAT_SRC ${TLS_COMPAT_SRC} compat/ftruncate.c) |
26 | set(TLS_COMPAT_SRC ${TLS_COMPAT_SRC} compat/pread.c) | ||
27 | set(TLS_COMPAT_SRC ${TLS_COMPAT_SRC} compat/pwrite.c) | ||
27 | endif() | 28 | endif() |
28 | 29 | ||
29 | add_definitions(-DTLS_DEFAULT_CA_FILE=\"${OPENSSLDIR}/cert.pem\") | 30 | add_definitions(-DTLS_DEFAULT_CA_FILE=\"${OPENSSLDIR}/cert.pem\") |
30 | 31 | ||
31 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym DESTINATION | 32 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym DESTINATION |
32 | ${CMAKE_CURRENT_BINARY_DIR}) | 33 | ${CMAKE_CURRENT_BINARY_DIR}) |
33 | if(LIBTLS_EXTRA_EXPORT) | 34 | |
34 | list(SORT LIBTLS_EXTRA_EXPORT) | 35 | add_library(tls_compat_obj OBJECT ${TLS_COMPAT_SRC}) |
35 | foreach(SYM IN LISTS LIBTLS_EXTRA_EXPORT) | 36 | target_include_directories(tls_compat_obj |
36 | file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/tls.sym "${SYM}\n") | 37 | PRIVATE |
37 | endforeach() | 38 | . |
38 | endif() | 39 | ../include/compat |
40 | PUBLIC | ||
41 | ../include | ||
42 | ${CMAKE_BINARY_DIR}/include) | ||
39 | 43 | ||
40 | add_library(tls_obj OBJECT ${TLS_SRC}) | 44 | add_library(tls_obj OBJECT ${TLS_SRC}) |
41 | target_include_directories(tls_obj | 45 | target_include_directories(tls_obj |
@@ -46,7 +50,11 @@ target_include_directories(tls_obj | |||
46 | ../include | 50 | ../include |
47 | ${CMAKE_BINARY_DIR}/include) | 51 | ${CMAKE_BINARY_DIR}/include) |
48 | 52 | ||
49 | add_library(tls $<TARGET_OBJECTS:tls_obj> empty.c) | 53 | if(BUILD_SHARED_LIBS) |
54 | add_library(tls $<TARGET_OBJECTS:tls_obj> $<TARGET_OBJECTS:tls_compat_obj> $<TARGET_OBJECTS:compat_obj> empty.c) | ||
55 | else() | ||
56 | add_library(tls $<TARGET_OBJECTS:tls_obj> $<TARGET_OBJECTS:tls_compat_obj> empty.c) | ||
57 | endif() | ||
50 | 58 | ||
51 | export_symbol(tls ${CMAKE_CURRENT_BINARY_DIR}/tls.sym) | 59 | export_symbol(tls ${CMAKE_CURRENT_BINARY_DIR}/tls.sym) |
52 | target_link_libraries(tls ${OPENSSL_LIBS}) | 60 | target_link_libraries(tls ${OPENSSL_LIBS}) |