diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 1425ad54d..df3f91969 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../include) - add_subdirectory(fipsmodule) add_subdirectory(test) @@ -298,7 +296,7 @@ endif() if(OPENSSL_NASM) target_sources(crypto PRIVATE ${CRYPTO_SOURCES_NASM}) endif() -target_include_directories(crypto INTERFACE +target_include_directories(crypto PUBLIC $ $ ) diff --git a/crypto/fipsmodule/CMakeLists.txt b/crypto/fipsmodule/CMakeLists.txt index 66fd44838..fc2d0dd77 100644 --- a/crypto/fipsmodule/CMakeLists.txt +++ b/crypto/fipsmodule/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../../include) - perlasm(BCM_SOURCES aarch64 aesv8-armv8 aes/asm/aesv8-armx.pl) perlasm(BCM_SOURCES aarch64 aesv8-gcm-armv8 modes/asm/aesv8-gcm-armv8.pl) perlasm(BCM_SOURCES aarch64 armv8-mont bn/asm/armv8-mont.pl) @@ -67,9 +65,8 @@ if(FIPS_DELOCATE) bcm.c ) - add_dependencies(bcm_c_generated_asm global_target) - + target_include_directories(bcm_c_generated_asm PRIVATE ../../include) set_target_properties(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S") set_target_properties(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON) @@ -104,9 +101,7 @@ if(FIPS_DELOCATE) bcm-delocated.S ) - add_dependencies(bcm_hashunset global_target) - set_target_properties(bcm_hashunset PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(bcm_hashunset PROPERTIES LINKER_LANGUAGE C) @@ -131,9 +126,8 @@ if(FIPS_DELOCATE) fips_shared_support.c ) - add_dependencies(fipsmodule global_target) - + target_include_directories(fipsmodule PRIVATE ../../include) set_target_properties(fipsmodule PROPERTIES LINKER_LANGUAGE C) elseif(FIPS_SHARED) if(NOT BUILD_SHARED_LIBS) @@ -147,8 +141,8 @@ elseif(FIPS_SHARED) fips_shared_support.c ) - add_dependencies(fipsmodule global_target) + target_include_directories(fipsmodule PRIVATE ../../include) add_library( bcm_library @@ -158,8 +152,8 @@ elseif(FIPS_SHARED) bcm.c ${BCM_SOURCES_ASM_USED} ) - add_dependencies(bcm_library global_target) + target_include_directories(bcm_library PRIVATE ../../include) add_custom_command( OUTPUT bcm.o @@ -179,6 +173,6 @@ else() fips_shared_support.c ${BCM_SOURCES_ASM_USED} ) - add_dependencies(fipsmodule global_target) + target_include_directories(fipsmodule PRIVATE ../../include) endif() diff --git a/decrepit/CMakeLists.txt b/decrepit/CMakeLists.txt index 2c10f0ee2..38d6f5da9 100644 --- a/decrepit/CMakeLists.txt +++ b/decrepit/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../include) - add_library( decrepit @@ -21,9 +19,7 @@ add_library( x509/x509_decrepit.c xts/xts.c ) - add_dependencies(decrepit global_target) - target_link_libraries(decrepit crypto ssl) add_executable( @@ -38,9 +34,7 @@ add_executable( $ ) - add_dependencies(decrepit_test global_target) - target_link_libraries(decrepit_test test_support_lib boringssl_gtest decrepit crypto) add_dependencies(all_tests decrepit_test) diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt index 8db1b7e8c..c6835eb77 100644 --- a/fuzz/CMakeLists.txt +++ b/fuzz/CMakeLists.txt @@ -1,10 +1,7 @@ -include_directories(../include) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes") - macro(fuzzer name) add_executable(${name} ${name}.cc) add_dependencies(${name} global_target) + target_compile_options(${name} PRIVATE "-Wno-missing-prototypes") target_link_libraries(${name} crypto ${ARGN}) if(LIBFUZZER_FROM_DEPS) set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer-no-link") diff --git a/rust/CMakeLists.txt b/rust/CMakeLists.txt index 9bdec3e58..344d80f5f 100644 --- a/rust/CMakeLists.txt +++ b/rust/CMakeLists.txt @@ -1,12 +1,8 @@ -# additional interop for things like macros and inlined functions -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include) -add_library( - rust_wrapper - STATIC - rust_wrapper.c -) +# Additional interop for things like macros and inlined functions. +add_library(rust_wrapper STATIC rust_wrapper.c) +target_link_libraries(rust_wrapper crypto) -# generate architecture specific wrappers +# Generate architecture-specific wrappers. set(WRAPPER_TARGET ${CMAKE_BINARY_DIR}/rust/src/wrapper_${RUST_BINDINGS}.rs) set(COMMAND ${BINDGEN_EXECUTABLE} "wrapper.h" -o ${WRAPPER_TARGET} diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index b558be4fd..ca4257944 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../include) - add_library( ssl @@ -41,19 +39,16 @@ add_library( tls13_enc.cc tls13_server.cc ) -target_include_directories(ssl INTERFACE - $ - $ -) +# Although libssl also provides headers that require an include directory, the +# flag is already specified by libcrypto, so we omit target_include_directories +# here. install(TARGETS ssl EXPORT OpenSSLTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) set_property(TARGET ssl PROPERTY EXPORT_NAME SSL) - add_dependencies(ssl global_target) - target_link_libraries(ssl crypto) add_executable( @@ -65,8 +60,6 @@ add_executable( $ ) - add_dependencies(ssl_test global_target) - target_link_libraries(ssl_test test_support_lib boringssl_gtest ssl crypto) add_dependencies(all_tests ssl_test) diff --git a/ssl/test/CMakeLists.txt b/ssl/test/CMakeLists.txt index 70bb29e8c..fa326aaaf 100644 --- a/ssl/test/CMakeLists.txt +++ b/ssl/test/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../../include) - add_executable( bssl_shim diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index e84d229fd..9cc7d2833 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../include) - add_executable( bssl diff --git a/util/fipstools/CMakeLists.txt b/util/fipstools/CMakeLists.txt index 63593838d..87960b479 100644 --- a/util/fipstools/CMakeLists.txt +++ b/util/fipstools/CMakeLists.txt @@ -1,12 +1,9 @@ -include_directories(../../include) - if(FIPS) add_executable( test_fips test_fips.c ) - add_dependencies(test_fips global_target) target_link_libraries(test_fips crypto) endif() diff --git a/util/fipstools/acvp/modulewrapper/CMakeLists.txt b/util/fipstools/acvp/modulewrapper/CMakeLists.txt index 267f82c37..45a941d1a 100644 --- a/util/fipstools/acvp/modulewrapper/CMakeLists.txt +++ b/util/fipstools/acvp/modulewrapper/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(../../../../include) - if(FIPS) add_executable( modulewrapper @@ -7,8 +5,6 @@ if(FIPS) main.cc modulewrapper.cc ) - add_dependencies(modulewrapper global_target) - target_link_libraries(modulewrapper crypto) endif() diff --git a/util/generate_build_files.py b/util/generate_build_files.py index faf6d8ab1..aec36bed8 100644 --- a/util/generate_build_files.py +++ b/util/generate_build_files.py @@ -487,8 +487,6 @@ if(BUILD_SHARED_LIBS) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) endif() -include_directories(src/include) - ''' def PrintLibrary(self, out, name, files): @@ -543,6 +541,7 @@ endif() self.PrintLibrary(cmake, 'crypto', files['crypto'] + ['${CRYPTO_SOURCES_ASM_USED}']) + cmake.write('target_include_directories(crypto PUBLIC src/include)\n') self.PrintLibrary(cmake, 'ssl', files['ssl']) self.PrintExe(cmake, 'bssl', files['tool'], ['ssl', 'crypto'])