From 48f794765b0df3310649e6a6c6f71c5cd845f445 Mon Sep 17 00:00:00 2001 From: Daniel Thornburgh Date: Mon, 25 Apr 2022 20:52:43 +0000 Subject: [PATCH] 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 Reviewed-by: David Benjamin Commit-Queue: David Benjamin --- CMakeLists.txt | 6 ++++-- crypto/CMakeLists.txt | 2 +- ssl/CMakeLists.txt | 2 +- tool/CMakeLists.txt | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dad27f815..202681db0 100644 --- a/CMakeLists.txt +++ b/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 diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 91ecb3ea5..67011589f 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -441,7 +441,7 @@ target_include_directories(crypto INTERFACE $ $ ) -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) diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index ed02bb56d..67a72ae26 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -45,7 +45,7 @@ target_include_directories(ssl INTERFACE $ $ ) -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) diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index e695f5633..f98e96e37 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -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)