Skip to content

Commit e319053

Browse files
authored
Cmake modules (#598)
1 parent bd88f32 commit e319053

11 files changed

+15
-28
lines changed

CMakeLists.txt

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.9)
1+
cmake_minimum_required(VERSION 3.9...3.31)
22
project(aws-crt-nodejs C)
33
option(BUILD_DEPS "Builds aws common runtime dependencies as part of build, only do this if you don't want to control your dependency chain." ON)
44

@@ -14,21 +14,7 @@ if (NOT CMAKE_BUILD_TYPE)
1414
set(CMAKE_BUILD_TYPE RelWithDebInfo)
1515
endif()
1616

17-
if (UNIX AND NOT APPLE)
18-
include(GNUInstallDirs)
19-
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
20-
set(CMAKE_INSTALL_LIBDIR "lib")
21-
endif()
22-
23-
if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
24-
set(FIND_LIBRARY_USE_LIB64_PATHS true)
25-
endif()
26-
27-
# This is required in order to append /lib/cmake to each element in CMAKE_PREFIX_PATH
28-
set(AWS_MODULE_DIR "/${CMAKE_INSTALL_LIBDIR}/cmake")
29-
string(REPLACE ";" "${AWS_MODULE_DIR};" AWS_MODULE_PATH "${CMAKE_PREFIX_PATH}${AWS_MODULE_DIR}")
30-
# Append that generated list to the module search path
31-
list(APPEND CMAKE_MODULE_PATH ${AWS_MODULE_PATH})
17+
include(GNUInstallDirs)
3218

3319
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/dist")
3420

@@ -76,12 +62,13 @@ if (BUILD_DEPS)
7662

7763
set(BUILD_TESTING ${BUILD_TESTING_PREV})
7864
else()
65+
# this is required so we can use aws-c-common's CMake modules
66+
find_package(aws-c-common REQUIRED)
67+
7968
include(AwsFindPackage)
8069
set(IN_SOURCE_BUILD OFF)
8170
endif()
8271

83-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake")
84-
8572
include(AwsCFlags)
8673
include(AwsSharedLibSetup)
8774
include(AwsSanitizers)

crt/aws-c-auth

crt/aws-c-sdkutils

0 commit comments

Comments
 (0)