Skip to content

Commit

Permalink
Fix aws-c-cal-config.cmake (#158)
Browse files Browse the repository at this point in the history
- Move `find_dependency()` calls before `include(aws-c-cal-targets.cmake)`
- Use `@VAR@` style variables in the [config file](https://cmake.org/cmake/help/latest/command/configure_file.html), so that it's simpler for the installed config file to remember how it was originally built.
  • Loading branch information
graebm authored Sep 13, 2023
1 parent 6ee9e65 commit e4c5067
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions cmake/aws-c-cal-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ include(CMakeFindDependencyMacro)

find_dependency(aws-c-common)

if (NOT @BYO_CRYPTO@ AND NOT WIN32 AND NOT APPLE) # if NOT BYO_CRYPTO AND NOT WIN32 AND NOT APPLE
if (@USE_OPENSSL@ AND NOT ANDROID) # if USE_OPENSSL AND NOT ANDROID
# aws-c-cal has been built with a dependency on OpenSSL::Crypto,
# therefore consumers of this library have a dependency on OpenSSL and must have it found
find_dependency(OpenSSL REQUIRED)
find_dependency(Threads REQUIRED)
else()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
find_dependency(crypto)
endif()
endif()

macro(aws_load_targets type)
include(${CMAKE_CURRENT_LIST_DIR}/${type}/@PROJECT_NAME@-targets.cmake)
endmacro()
Expand All @@ -20,18 +32,3 @@ else()
aws_load_targets(shared)
endif()
endif()

if (NOT BYO_CRYPTO AND NOT WIN32 AND NOT APPLE)
get_target_property(AWS_C_CAL_DEPS AWS::aws-c-cal INTERFACE_LINK_LIBRARIES)
# pre-cmake 3.3 IN_LIST search approach
list (FIND AWS_C_CAL_DEPS "OpenSSL::Crypto" _index)
if (${_index} GREATER -1) # if USE_OPENSSL AND NOT ANDROID
# aws-c-cal has been built with a dependency on OpenSSL::Crypto,
# therefore consumers of this library have a dependency on OpenSSL and must have it found
find_dependency(OpenSSL REQUIRED)
find_dependency(Threads REQUIRED)
else()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
find_dependency(crypto)
endif()
endif()

0 comments on commit e4c5067

Please sign in to comment.