Skip to content

Commit

Permalink
load cmake target fallback (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Aug 16, 2022
1 parent 831fa58 commit b7923ae
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmake/aws-c-auth-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ find_dependency(aws-c-io)
find_dependency(aws-c-http)
find_dependency(aws-c-sdkutils)

macro(aws_load_targets type)
include(${CMAKE_CURRENT_LIST_DIR}/${type}/@PROJECT_NAME@-targets.cmake)
endmacro()

# try to load the lib follow BUILD_SHARED_LIBS. Fall back if not exist.
if (BUILD_SHARED_LIBS)
include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake)
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/shared")
aws_load_targets(shared)
else()
aws_load_targets(static)
endif()
else()
include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake)
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/static")
aws_load_targets(static)
else()
aws_load_targets(shared)
endif()
endif()

0 comments on commit b7923ae

Please sign in to comment.