Specify -Iinclude with the crypto target.

It's unclear to me whether doing it target-by-target is an improvement
in crypto/fipsmodule, but this otherwise does seem a bit tidier. This
aligns with CMake's documentation and "modern CMake" which prefers this
pattern.

Change-Id: I36c81842bff8b36eeaaf5dd3e0695fb45f3376c9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56585
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
fips-20230428
David Benjamin 2 years ago committed by Boringssl LUCI CQ
parent de12e3cabc
commit 0e68520eb2
  1. 4
      crypto/CMakeLists.txt
  2. 16
      crypto/fipsmodule/CMakeLists.txt
  3. 6
      decrepit/CMakeLists.txt
  4. 5
      fuzz/CMakeLists.txt
  5. 12
      rust/CMakeLists.txt
  6. 13
      ssl/CMakeLists.txt
  7. 2
      ssl/test/CMakeLists.txt
  8. 2
      tool/CMakeLists.txt
  9. 3
      util/fipstools/CMakeLists.txt
  10. 4
      util/fipstools/acvp/modulewrapper/CMakeLists.txt
  11. 3
      util/generate_build_files.py

@ -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
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

@ -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()

@ -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(
$<TARGET_OBJECTS:boringssl_gtest_main>
)
add_dependencies(decrepit_test global_target)
target_link_libraries(decrepit_test test_support_lib boringssl_gtest decrepit
crypto)
add_dependencies(all_tests decrepit_test)

@ -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")

@ -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}

@ -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
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# 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(
$<TARGET_OBJECTS:boringssl_gtest_main>
)
add_dependencies(ssl_test global_target)
target_link_libraries(ssl_test test_support_lib boringssl_gtest ssl crypto)
add_dependencies(all_tests ssl_test)

@ -1,5 +1,3 @@
include_directories(../../include)
add_executable(
bssl_shim

@ -1,5 +1,3 @@
include_directories(../include)
add_executable(
bssl

@ -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()

@ -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()

@ -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'])

Loading…
Cancel
Save