diff --git a/CMakeLists.txt b/CMakeLists.txt index 59a960a8b6..f72de64205 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -355,7 +355,7 @@ if(NOT DISABLE_PACKAGE_CONFIG_AND_INSTALL) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/MbedTLSConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake/MbedTLSConfigVersion.cmake" - DESTINATION "cmake") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/MbedTLS") export( EXPORT MbedTLSTargets @@ -365,7 +365,7 @@ if(NOT DISABLE_PACKAGE_CONFIG_AND_INSTALL) install( EXPORT MbedTLSTargets NAMESPACE MbedTLS:: - DESTINATION "cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/MbedTLS" FILE "MbedTLSTargets.cmake") if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) diff --git a/ChangeLog.d/cmake-install.txt b/ChangeLog.d/cmake-install.txt new file mode 100644 index 0000000000..d8eb72e1ec --- /dev/null +++ b/ChangeLog.d/cmake-install.txt @@ -0,0 +1,3 @@ +Changes + * Install the .cmake files into CMAKE_INSTALL_LIBDIR/cmake/MbedTLS, + typically /usr/lib/cmake/MbedTLS. diff --git a/programs/test/cmake_package_install/CMakeLists.txt b/programs/test/cmake_package_install/CMakeLists.txt index 711a1e506e..fb5ad51b54 100644 --- a/programs/test/cmake_package_install/CMakeLists.txt +++ b/programs/test/cmake_package_install/CMakeLists.txt @@ -26,7 +26,7 @@ execute_process( # Locate the package. # -set(MbedTLS_DIR "${MbedTLS_INSTALL_DIR}/cmake") +list(INSERT CMAKE_PREFIX_PATH 0 "${MbedTLS_INSTALL_DIR}") find_package(MbedTLS REQUIRED) #