Fix build for older CMake versions.

CMake versions newer than ~3.1x automatically determine the subdirectory under CMAKE_INSTALL_PREFIX using the type of the installed target. Older versions need this to be manually computed using the GNUInstallDirs library.

Since we override the CMAKE_INSTALL_PREFIX default, this just controls
the internal layout of the install/ directory generated underneath the
boringssl checkout.

Bug: 488
Change-Id: I97b02006301e463bb0cfd54acb2b27656484cc85
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52345
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
fips-20220613
Daniel Thornburgh 3 years ago committed by Boringssl LUCI CQ
parent 15302de895
commit 48f794765b
  1. 6
      CMakeLists.txt
  2. 2
      crypto/CMakeLists.txt
  3. 2
      ssl/CMakeLists.txt
  4. 2
      tool/CMakeLists.txt

@ -20,6 +20,8 @@ include(sources.cmake)
enable_language(C)
enable_language(CXX)
include(GNUInstallDirs)
# This is a dummy target which all other targets depend on (manually - see other
# CMakeLists.txt files). This gives us a hook to add any targets which need to
# run before all other targets.
@ -563,7 +565,7 @@ if(USE_CUSTOM_LIBCXX)
-DLIBCXX_BUILDING_LIBCXXABI
)
target_link_libraries(libcxx libcxxabi)
install(TARGETS libcxx EXPORT OpenSSLTargets)
install(TARGETS libcxx EXPORT OpenSSLTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
# Add minimal googletest targets. The provided one has many side-effects, and
@ -665,7 +667,7 @@ add_custom_target(
DEPENDS all_tests bssl_shim handshaker fips_specific_tests_if_any
USES_TERMINAL)
install(DIRECTORY include/ TYPE INCLUDE)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT OpenSSLTargets
FILE OpenSSLTargets.cmake

@ -441,7 +441,7 @@ target_include_directories(crypto INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(TARGETS crypto EXPORT OpenSSLTargets)
install(TARGETS crypto EXPORT OpenSSLTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
set_property(TARGET crypto PROPERTY EXPORT_NAME Crypto)
if(FIPS_SHARED)

@ -45,7 +45,7 @@ target_include_directories(ssl INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(TARGETS ssl EXPORT OpenSSLTargets)
install(TARGETS ssl EXPORT OpenSSLTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
set_property(TARGET ssl PROPERTY EXPORT_NAME SSL)
add_dependencies(ssl global_target)

@ -21,7 +21,7 @@ add_executable(
tool.cc
transport_common.cc
)
install(TARGETS bssl)
install(TARGETS bssl DESTINATION ${CMAKE_INSTALL_BINDIR})
add_dependencies(bssl global_target)

Loading…
Cancel
Save