From 87d8364cc995c2ae7eeefbee4a156d31198f3282 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 19 Dec 2024 13:18:43 -0800 Subject: [PATCH] Install cmake config to more standard location --- CMakeLists.txt | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0f030b98..ef1854134 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,27 +2,11 @@ cmake_minimum_required(VERSION 3.9) project(aws-c-io C) -if (DEFINED CMAKE_PREFIX_PATH) - file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH) +if (NOT IN_SOURCE_BUILD) + # this is required so we can use aws-c-common's CMake modules + find_package(aws-c-common REQUIRED) endif() -if (DEFINED CMAKE_INSTALL_PREFIX) - file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) -endif() - - -if (UNIX AND NOT APPLE) - include(GNUInstallDirs) -elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR "lib") -endif() - -# This is required in order to append /lib/cmake to each element in CMAKE_PREFIX_PATH -set(AWS_MODULE_DIR "/${CMAKE_INSTALL_LIBDIR}/cmake") -string(REPLACE ";" "${AWS_MODULE_DIR};" AWS_MODULE_PATH "${CMAKE_PREFIX_PATH}${AWS_MODULE_DIR}") -# Append that generated list to the module search path -list(APPEND CMAKE_MODULE_PATH ${AWS_MODULE_PATH}) - include(AwsCFlags) include(AwsCheckHeaders) include(AwsSharedLibSetup) @@ -226,7 +210,7 @@ else() endif() install(EXPORT "${PROJECT_NAME}-targets" - DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}" + DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}/${TARGET_DIR}" NAMESPACE AWS:: COMPONENT Development) @@ -235,7 +219,7 @@ configure_file("cmake/${PROJECT_NAME}-config.cmake" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" - DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/" + DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}/" COMPONENT Development) if (NOT CMAKE_CROSSCOMPILING)