diff options
author | d3x0r <d3x0r@users.noreply.github.com> | 2017-07-06 02:09:44 -0700 |
---|---|---|
committer | d3x0r <d3x0r@users.noreply.github.com> | 2017-07-06 02:09:44 -0700 |
commit | 2557dd7439806448ad41b7bc5f175f4ed4f74d9c (patch) | |
tree | aeec866073e16350de88b84b05d11b7578c3db1c | |
parent | 728bda183018cbc9736f03d4f21d2b4a2585e83d (diff) | |
download | portable-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.txt | 6 | ||||
-rw-r--r-- | apps/nc/CMakeLists.txt | 6 | ||||
-rw-r--r-- | apps/ocspcheck/CMakeLists.txt | 6 | ||||
-rw-r--r-- | apps/openssl/CMakeLists.txt | 12 | ||||
-rw-r--r-- | crypto/CMakeLists.txt | 8 | ||||
-rw-r--r-- | include/CMakeLists.txt | 12 | ||||
-rw-r--r-- | man/CMakeLists.txt | 18 | ||||
-rw-r--r-- | ssl/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tls/CMakeLists.txt | 8 |
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) | |||
26 | string(REPLACE ":" "." TLS_VERSION ${TLS_VERSION}) | 26 | string(REPLACE ":" "." TLS_VERSION ${TLS_VERSION}) |
27 | string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION}) | 27 | string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION}) |
28 | 28 | ||
29 | option(LIBRESSL_SKIP_INSTALL "Skip installation" ${LIBRESSL_SKIP_INSTALL}) | ||
29 | option(ENABLE_ASM "Enable assembly" ON) | 30 | option(ENABLE_ASM "Enable assembly" ON) |
30 | option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) | 31 | option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) |
31 | option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) | 32 | option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) |
32 | option(ENABLE_VSTEST "Enable test on Visual Studio" OFF) | 33 | option(ENABLE_VSTEST "Enable test on Visual Studio" OFF) |
33 | set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) | 34 | set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) |
34 | 35 | ||
36 | if(NOT LIBRESSL_SKIP_INSTALL) | ||
37 | set( ENABLE_LIBRESSL_INSTALL ON ) | ||
38 | endif(NOT LIBRESSL_SKIP_INSTALL) | ||
39 | |||
40 | |||
35 | set(BUILD_NC true) | 41 | set(BUILD_NC true) |
36 | 42 | ||
37 | if(CMAKE_SYSTEM_NAME MATCHES "Darwin") | 43 | if(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}) | |||
53 | target_link_libraries(nc tls ${OPENSSL_LIBS}) | 53 | target_link_libraries(nc tls ${OPENSSL_LIBS}) |
54 | 54 | ||
55 | if(ENABLE_NC) | 55 | if(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) | ||
58 | endif() | 60 | endif() |
59 | 61 | ||
60 | endif() | 62 | endif() |
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() | |||
36 | add_executable(ocspcheck ${OCSPCHECK_SRC}) | 36 | add_executable(ocspcheck ${OCSPCHECK_SRC}) |
37 | target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) | 37 | target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) |
38 | 38 | ||
39 | install(TARGETS ocspcheck DESTINATION bin) | 39 | if(ENABLE_LIBRESSL_INSTALL) |
40 | install(FILES ocspcheck.8 DESTINATION share/man/man8) | 40 | install(TARGETS ocspcheck DESTINATION bin) |
41 | install(FILES ocspcheck.8 DESTINATION share/man/man8) | ||
42 | endif(ENABLE_LIBRESSL_INSTALL) | ||
41 | 43 | ||
42 | endif() | 44 | endif() |
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() | |||
76 | add_executable(openssl ${OPENSSL_SRC}) | 76 | add_executable(openssl ${OPENSSL_SRC}) |
77 | target_link_libraries(openssl ${OPENSSL_LIBS}) | 77 | target_link_libraries(openssl ${OPENSSL_LIBS}) |
78 | 78 | ||
79 | install(TARGETS openssl DESTINATION bin) | 79 | if(ENABLE_LIBRESSL_INSTALL) |
80 | install(FILES openssl.1 DESTINATION share/man/man1) | 80 | install(TARGETS openssl DESTINATION bin) |
81 | install(FILES openssl.1 DESTINATION share/man/man1) | ||
82 | endif(ENABLE_LIBRESSL_INSTALL) | ||
81 | 83 | ||
82 | if(NOT "${OPENSSLDIR}" STREQUAL "") | 84 | if(NOT "${OPENSSLDIR}" STREQUAL "") |
83 | set(CONF_DIR "${OPENSSLDIR}") | 85 | set(CONF_DIR "${OPENSSLDIR}") |
84 | else() | 86 | else() |
85 | set(CONF_DIR "${CMAKE_INSTALL_PREFIX}/etc/ssl") | 87 | set(CONF_DIR "${CMAKE_INSTALL_PREFIX}/etc/ssl") |
86 | endif() | 88 | endif() |
87 | install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR}) | 89 | if(ENABLE_LIBRESSL_INSTALL) |
88 | install(DIRECTORY DESTINATION ${CONF_DIR}/cert) | 90 | install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR}) |
91 | install(DIRECTORY DESTINATION ${CONF_DIR}/cert) | ||
92 | endif(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) | ||
833 | else() | 835 | else() |
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) | ||
836 | endif() | 840 | endif() |
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 @@ | |||
1 | install(DIRECTORY . | 1 | if(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) | ||
7 | endif(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 @@ | |||
1 | install(DIRECTORY . | 1 | if(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 | ||
6 | install(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 | ) |
11 | endif(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) | ||
64 | else() | 66 | else() |
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) | ||
67 | endif() | 71 | endif() |
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) | ||
43 | else() | 45 | else() |
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) | ||
46 | endif() | 50 | endif() |
47 | 51 | ||