Skip to content

Commit

Permalink
CMake improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm committed Dec 20, 2024
1 parent 2eee416 commit df51efe
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 24 deletions.
19 changes: 5 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.9...3.31)
project(aws-crt-nodejs C)
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)

Expand All @@ -14,22 +14,12 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()

if (UNIX AND NOT APPLE)
include(GNUInstallDirs)
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
include(GNUInstallDirs)

if (${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
set(FIND_LIBRARY_USE_LIB64_PATHS true)
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})

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

if (BUILD_DEPS)
Expand Down Expand Up @@ -76,12 +66,13 @@ if (BUILD_DEPS)

set(BUILD_TESTING ${BUILD_TESTING_PREV})
else()
# this is required so we can use aws-c-common's CMake modules
find_package(aws-c-common REQUIRED)

include(AwsFindPackage)
set(IN_SOURCE_BUILD OFF)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/cmake")

include(AwsCFlags)
include(AwsSharedLibSetup)
include(AwsSanitizers)
Expand Down
2 changes: 1 addition & 1 deletion crt/aws-c-auth
2 changes: 1 addition & 1 deletion crt/aws-c-http
2 changes: 1 addition & 1 deletion crt/aws-c-io

0 comments on commit df51efe

Please sign in to comment.