Skip to content

Commit

Permalink
A bunch of CMake fixes (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm authored Jan 28, 2025
1 parent 2c7d355 commit fb8bd0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 78 deletions.
30 changes: 8 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.9...3.31)

option(STATIC_CRT "Windows specific option that to specify static/dynamic run-time library" OFF)

project (aws-checksums 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(AwsSIMD)
include(AwsCFlags)
include(AwsCheckHeaders)
Expand All @@ -32,6 +17,7 @@ include(AwsSanitizers)
include(CheckCCompilerFlag)
include(AwsFindPackage)
include(AwsFeatureTests)
include(GNUInstallDirs)

file(GLOB AWS_CHECKSUMS_HEADERS
"include/aws/checksums/*.h"
Expand Down Expand Up @@ -137,7 +123,7 @@ aws_use_package(aws-c-common)
target_link_libraries(${PROJECT_NAME} PUBLIC ${DEP_AWS_LIBS})
aws_prepare_shared_lib_exports(${PROJECT_NAME})

install(FILES ${AWS_CHECKSUMS_HEADERS} DESTINATION "include/aws/checksums" COMPONENT Development)
install(FILES ${AWS_CHECKSUMS_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/checksums" COMPONENT Development)

if (BUILD_SHARED_LIBS)
set (TARGET_DIR "shared")
Expand All @@ -146,7 +132,7 @@ else()
endif()

install(EXPORT "${PROJECT_NAME}-targets"
DESTINATION "${LIBRARY_DIRECTORY}/${PROJECT_NAME}/cmake/${TARGET_DIR}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${TARGET_DIR}"
NAMESPACE AWS::
COMPONENT Development)

Expand All @@ -155,7 +141,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 "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/"
COMPONENT Development)

include(CTest)
Expand Down
4 changes: 1 addition & 3 deletions bin/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
project(checksum-profile C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake")

file(GLOB PROFILE_SRC
"*.c"
)
Expand All @@ -25,5 +23,5 @@ install(TARGETS ${PROFILE_PROJECT_NAME}
EXPORT ${PROFILE_PROJECT_NAME}-targets
COMPONENT Runtime
RUNTIME
DESTINATION bin
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Runtime)
53 changes: 0 additions & 53 deletions cmake/AwsSharedLibSetup.cmake

This file was deleted.

0 comments on commit fb8bd0b

Please sign in to comment.