aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authord3x0r <d3x0r@users.noreply.github.com>2017-07-06 02:09:44 -0700
committerd3x0r <d3x0r@users.noreply.github.com>2017-07-06 02:09:44 -0700
commit2557dd7439806448ad41b7bc5f175f4ed4f74d9c (patch)
treeaeec866073e16350de88b84b05d11b7578c3db1c
parent728bda183018cbc9736f03d4f21d2b4a2585e83d (diff)
downloadportable-2557dd7439806448ad41b7bc5f175f4ed4f74d9c.tar.gz
portable-2557dd7439806448ad41b7bc5f175f4ed4f74d9c.tar.bz2
portable-2557dd7439806448ad41b7bc5f175f4ed4f74d9c.zip
Add option LIBRESSL_SKIP_INSTALL
Internally LIBRESSL_SKIP_INSTALL, if not set becomes ENABLE_LIBRESSL_INSTALL so this by default is enabled. defining LIBRESSL_SKIP_INSTALL before hand will disable all install() rules. This is useful if another project includes and links to this statically. I chose to add a prefix to avoid potential name collision because the options are cached globally. If the installation is skipped, maybe it should also disable building apps? I didn't do that.
-rw-r--r--CMakeLists.txt6
-rw-r--r--apps/nc/CMakeLists.txt6
-rw-r--r--apps/ocspcheck/CMakeLists.txt6
-rw-r--r--apps/openssl/CMakeLists.txt12
-rw-r--r--crypto/CMakeLists.txt8
-rw-r--r--include/CMakeLists.txt12
-rw-r--r--man/CMakeLists.txt18
-rw-r--r--ssl/CMakeLists.txt8
-rw-r--r--tls/CMakeLists.txt8
9 files changed, 57 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 570e0ef..bfd1363 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,12 +26,18 @@ string(STRIP ${TLS_VERSION} TLS_VERSION)
26string(REPLACE ":" "." TLS_VERSION ${TLS_VERSION}) 26string(REPLACE ":" "." TLS_VERSION ${TLS_VERSION})
27string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION}) 27string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION})
28 28
29option(LIBRESSL_SKIP_INSTALL "Skip installation" ${LIBRESSL_SKIP_INSTALL})
29option(ENABLE_ASM "Enable assembly" ON) 30option(ENABLE_ASM "Enable assembly" ON)
30option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) 31option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF)
31option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) 32option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF)
32option(ENABLE_VSTEST "Enable test on Visual Studio" OFF) 33option(ENABLE_VSTEST "Enable test on Visual Studio" OFF)
33set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) 34set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
34 35
36if(NOT LIBRESSL_SKIP_INSTALL)
37 set( ENABLE_LIBRESSL_INSTALL ON )
38endif(NOT LIBRESSL_SKIP_INSTALL)
39
40
35set(BUILD_NC true) 41set(BUILD_NC true)
36 42
37if(CMAKE_SYSTEM_NAME MATCHES "Darwin") 43if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
diff --git a/apps/nc/CMakeLists.txt b/apps/nc/CMakeLists.txt
index c8757a6..424c676 100644
--- a/apps/nc/CMakeLists.txt
+++ b/apps/nc/CMakeLists.txt
@@ -53,8 +53,10 @@ add_executable(nc ${NC_SRC})
53target_link_libraries(nc tls ${OPENSSL_LIBS}) 53target_link_libraries(nc tls ${OPENSSL_LIBS})
54 54
55if(ENABLE_NC) 55if(ENABLE_NC)
56 install(TARGETS nc DESTINATION bin) 56 if(ENABLE_LIBRESSL_INSTALL)
57 install(FILES nc.1 DESTINATION share/man/man1) 57 install(TARGETS nc DESTINATION bin)
58 install(FILES nc.1 DESTINATION share/man/man1)
59 endif(ENABLE_LIBRESSL_INSTALL)
58endif() 60endif()
59 61
60endif() 62endif()
diff --git a/apps/ocspcheck/CMakeLists.txt b/apps/ocspcheck/CMakeLists.txt
index a14485e..064c367 100644
--- a/apps/ocspcheck/CMakeLists.txt
+++ b/apps/ocspcheck/CMakeLists.txt
@@ -36,7 +36,9 @@ endif()
36add_executable(ocspcheck ${OCSPCHECK_SRC}) 36add_executable(ocspcheck ${OCSPCHECK_SRC})
37target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) 37target_link_libraries(ocspcheck tls ${OPENSSL_LIBS})
38 38
39install(TARGETS ocspcheck DESTINATION bin) 39if(ENABLE_LIBRESSL_INSTALL)
40install(FILES ocspcheck.8 DESTINATION share/man/man8) 40 install(TARGETS ocspcheck DESTINATION bin)
41 install(FILES ocspcheck.8 DESTINATION share/man/man8)
42endif(ENABLE_LIBRESSL_INSTALL)
41 43
42endif() 44endif()
diff --git a/apps/openssl/CMakeLists.txt b/apps/openssl/CMakeLists.txt
index 9512065..cf5c852 100644
--- a/apps/openssl/CMakeLists.txt
+++ b/apps/openssl/CMakeLists.txt
@@ -76,13 +76,17 @@ endif()
76add_executable(openssl ${OPENSSL_SRC}) 76add_executable(openssl ${OPENSSL_SRC})
77target_link_libraries(openssl ${OPENSSL_LIBS}) 77target_link_libraries(openssl ${OPENSSL_LIBS})
78 78
79install(TARGETS openssl DESTINATION bin) 79if(ENABLE_LIBRESSL_INSTALL)
80install(FILES openssl.1 DESTINATION share/man/man1) 80 install(TARGETS openssl DESTINATION bin)
81 install(FILES openssl.1 DESTINATION share/man/man1)
82endif(ENABLE_LIBRESSL_INSTALL)
81 83
82if(NOT "${OPENSSLDIR}" STREQUAL "") 84if(NOT "${OPENSSLDIR}" STREQUAL "")
83 set(CONF_DIR "${OPENSSLDIR}") 85 set(CONF_DIR "${OPENSSLDIR}")
84else() 86else()
85 set(CONF_DIR "${CMAKE_INSTALL_PREFIX}/etc/ssl") 87 set(CONF_DIR "${CMAKE_INSTALL_PREFIX}/etc/ssl")
86endif() 88endif()
87install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR}) 89if(ENABLE_LIBRESSL_INSTALL)
88install(DIRECTORY DESTINATION ${CONF_DIR}/cert) 90 install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR})
91 install(DIRECTORY DESTINATION ${CONF_DIR}/cert)
92endif(ENABLE_LIBRESSL_INSTALL)
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index f8c5684..a2b4817 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -829,9 +829,13 @@ if (BUILD_SHARED)
829 ARCHIVE_OUTPUT_NAME crypto${CRYPTO_POSTFIX}) 829 ARCHIVE_OUTPUT_NAME crypto${CRYPTO_POSTFIX})
830 set_target_properties(crypto-shared PROPERTIES VERSION 830 set_target_properties(crypto-shared PROPERTIES VERSION
831 ${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION}) 831 ${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION})
832 install(TARGETS crypto crypto-shared DESTINATION lib) 832 if(ENABLE_LIBRESSL_INSTALL)
833 install(TARGETS crypto crypto-shared DESTINATION lib)
834 endif(ENABLE_LIBRESSL_INSTALL)
833else() 835else()
834 add_library(crypto STATIC ${CRYPTO_SRC}) 836 add_library(crypto STATIC ${CRYPTO_SRC})
835 install(TARGETS crypto DESTINATION lib) 837 if(ENABLE_LIBRESSL_INSTALL)
838 install(TARGETS crypto DESTINATION lib)
839 endif(ENABLE_LIBRESSL_INSTALL)
836endif() 840endif()
837 841
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 110caa5..870c740 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,5 +1,7 @@
1install(DIRECTORY . 1if(ENABLE_LIBRESSL_INSTALL)
2 DESTINATION include 2 install(DIRECTORY .
3 PATTERN "CMakeLists.txt" EXCLUDE 3 DESTINATION include
4 PATTERN "compat" EXCLUDE 4 PATTERN "CMakeLists.txt" EXCLUDE
5 PATTERN "Makefile*" EXCLUDE) 5 PATTERN "compat" EXCLUDE
6 PATTERN "Makefile*" EXCLUDE)
7endif(ENABLE_LIBRESSL_INSTALL)
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 5923f58..f08091c 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -1,9 +1,11 @@
1install(DIRECTORY . 1if(ENABLE_LIBRESSL_INSTALL)
2 DESTINATION share/man/man3 2 install(DIRECTORY .
3 FILES_MATCHING PATTERN "*.3" 3 DESTINATION share/man/man3
4 ) 4 FILES_MATCHING PATTERN "*.3"
5 )
5 6
6install(DIRECTORY . 7 install(DIRECTORY .
7 DESTINATION share/man/man1 8 DESTINATION share/man/man1
8 FILES_MATCHING PATTERN "*.1" 9 FILES_MATCHING PATTERN "*.1"
9 ) 10 )
11endif(ENABLE_LIBRESSL_INSTALL)
diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt
index bc2fea4..0e1c326 100644
--- a/ssl/CMakeLists.txt
+++ b/ssl/CMakeLists.txt
@@ -60,8 +60,12 @@ if (BUILD_SHARED)
60 ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX}) 60 ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX})
61 set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION} 61 set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION}
62 SOVERSION ${SSL_MAJOR_VERSION}) 62 SOVERSION ${SSL_MAJOR_VERSION})
63 install(TARGETS ssl ssl-shared DESTINATION lib) 63 if(ENABLE_LIBRESSL_INSTALL)
64 install(TARGETS ssl ssl-shared DESTINATION lib)
65 endif(ENABLE_LIBRESSL_INSTALL)
64else() 66else()
65 add_library(ssl STATIC ${SSL_SRC}) 67 add_library(ssl STATIC ${SSL_SRC})
66 install(TARGETS ssl DESTINATION lib) 68 if(ENABLE_LIBRESSL_INSTALL)
69 install(TARGETS ssl DESTINATION lib)
70 endif(ENABLE_LIBRESSL_INSTALL)
67endif() 71endif()
diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt
index b71fb37..ab73460 100644
--- a/tls/CMakeLists.txt
+++ b/tls/CMakeLists.txt
@@ -39,9 +39,13 @@ if (BUILD_SHARED)
39 ARCHIVE_OUTPUT_NAME tls${TLS_POSTFIX}) 39 ARCHIVE_OUTPUT_NAME tls${TLS_POSTFIX})
40 set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION} 40 set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION}
41 SOVERSION ${TLS_MAJOR_VERSION}) 41 SOVERSION ${TLS_MAJOR_VERSION})
42 install(TARGETS tls tls-shared DESTINATION lib) 42 if(ENABLE_LIBRESSL_INSTALL)
43 install(TARGETS tls tls-shared DESTINATION lib)
44 endif(ENABLE_LIBRESSL_INSTALL)
43else() 45else()
44 add_library(tls STATIC ${TLS_SRC}) 46 add_library(tls STATIC ${TLS_SRC})
45 install(TARGETS tls DESTINATION lib) 47 if(ENABLE_LIBRESSL_INSTALL)
48 install(TARGETS tls DESTINATION lib)
49 endif(ENABLE_LIBRESSL_INSTALL)
46endif() 50endif()
47 51