From 4fcfc82d83de32098530abfa3aff5d6fc5532433 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 29 May 2018 05:44:34 -0500 Subject: scope private/public headers when embedding into other projects thanks to Cameron Palmer --- apps/nc/CMakeLists.txt | 8 +------- apps/ocspcheck/CMakeLists.txt | 8 +------- apps/openssl/CMakeLists.txt | 7 +------ crypto/CMakeLists.txt | 23 ++++++++++++----------- ssl/CMakeLists.txt | 13 +++++++------ tests/CMakeLists.txt | 2 -- tls/CMakeLists.txt | 13 +++++++------ 7 files changed, 29 insertions(+), 45 deletions(-) diff --git a/apps/nc/CMakeLists.txt b/apps/nc/CMakeLists.txt index 64d14fa..30c1745 100644 --- a/apps/nc/CMakeLists.txt +++ b/apps/nc/CMakeLists.txt @@ -1,12 +1,5 @@ if(BUILD_NC) -include_directories( - . - ./compat - ../../include - ../../include/compat -) - set( NC_SRC atomicio.c @@ -50,6 +43,7 @@ else() endif() add_executable(nc ${NC_SRC}) +target_include_directories(nc PRIVATE . ./compat) target_link_libraries(nc tls ${OPENSSL_LIBS}) if(ENABLE_NC) diff --git a/apps/ocspcheck/CMakeLists.txt b/apps/ocspcheck/CMakeLists.txt index 15af8a8..9e0d012 100644 --- a/apps/ocspcheck/CMakeLists.txt +++ b/apps/ocspcheck/CMakeLists.txt @@ -1,12 +1,5 @@ if(NOT MSVC) -include_directories( - . - ./compat - ../../include - ../../include/compat -) - set( OCSPCHECK_SRC http.c @@ -27,6 +20,7 @@ else() endif() add_executable(ocspcheck ${OCSPCHECK_SRC}) +target_include_directories(ocspcheck PRIVATE . ./compat) target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) if(ENABLE_LIBRESSL_INSTALL) diff --git a/apps/openssl/CMakeLists.txt b/apps/openssl/CMakeLists.txt index 8b800c4..1fe9004 100644 --- a/apps/openssl/CMakeLists.txt +++ b/apps/openssl/CMakeLists.txt @@ -1,9 +1,3 @@ -include_directories( - . - ../../include - ../../include/compat -) - set( OPENSSL_SRC apps.c @@ -74,6 +68,7 @@ else() endif() add_executable(openssl ${OPENSSL_SRC}) +target_include_directories(openssl PRIVATE .) target_link_libraries(openssl ${OPENSSL_LIBS}) if(ENABLE_LIBRESSL_INSTALL) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 2fa08a5..ded07af 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -1,14 +1,3 @@ -include_directories( - . - ../include - ../include/compat - asn1 - bn - dsa - evp - modes -) - if(HOST_ASM_ELF_X86_64) set( ASM_X86_64_ELF_SRC @@ -810,6 +799,18 @@ if(EXTRA_EXPORT) endif() add_library(crypto ${CRYPTO_SRC}) +target_include_directories(crypto + PRIVATE + . + asn1 + bn + dsa + evp + modes + PUBLIC + ../include + ../include/compat) + if (BUILD_SHARED_LIBS) export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) if (WIN32) diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index e87e0f6..44e5265 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -1,9 +1,3 @@ -include_directories( - . - ../include - ../include/compat -) - set( SSL_SRC bio_ssl.c @@ -48,6 +42,13 @@ set( ) add_library(ssl ${SSL_SRC}) +target_include_directories(ssl + PRIVATE + . + PUBLIC + ../include + ../include/compat) + if (BUILD_SHARED_LIBS) export_symbol(ssl ${CMAKE_CURRENT_SOURCE_DIR}/ssl.sym) target_link_libraries(ssl crypto) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9c79313..065d934 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,5 @@ include_directories( . - ../include - ../include/compat ../crypto/modes ../crypto/asn1 ../ssl diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt index 6c5303c..a18c24f 100644 --- a/tls/CMakeLists.txt +++ b/tls/CMakeLists.txt @@ -1,9 +1,3 @@ -include_directories( - . - ../include - ../include/compat -) - set( TLS_SRC tls.c @@ -37,6 +31,13 @@ else() endif() add_library(tls ${TLS_SRC}) +target_include_directories(tls + PRIVATE + . + PUBLIC + ../include + ../include/compat) + if (BUILD_SHARED_LIBS) export_symbol(tls ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym) target_link_libraries(tls ssl crypto) -- cgit v1.2.3-55-g6feb