Skip to content

Commit 6952c4f

Browse files
authored
Make generated CMake files valid when install paths are absolute (aws#2630)
1 parent 2e98b9f commit 6952c4f

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

cmake/AWSSDKConfig.cmake

+12-8
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,18 @@ if (NOT AWSSDK_CORE_HEADER_FILE)
9898
message(FATAL_ERROR "AWS SDK for C++ is missing, please install it first")
9999
endif()
100100

101-
# based on core header file path, inspects the actual AWSSDK_ROOT_DIR
102-
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_CORE_HEADER_FILE}" PATH)
103-
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
104-
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
105-
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
106-
107-
if (NOT AWSSDK_ROOT_DIR)
108-
message(FATAL_ERROR "AWSSDK_ROOT_DIR is not set or can't be calculated from the path of core header file")
101+
if (IS_ABSOLUTE ${AWSSDK_INSTALL_LIBDIR})
102+
set(AWSSDK_ROOT_DIR "")
103+
else()
104+
# based on core header file path, inspects the actual AWSSDK_ROOT_DIR
105+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_CORE_HEADER_FILE}" PATH)
106+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
107+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
108+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
109+
110+
if (NOT AWSSDK_ROOT_DIR)
111+
message(FATAL_ERROR "AWSSDK_ROOT_DIR is not set or can't be calculated from the path of core header file")
112+
endif()
109113
endif()
110114

111115

toolchains/pkg-config.pc.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
includedir=@CMAKE_INSTALL_PREFIX@/@INCLUDE_DIRECTORY@
2-
libdir=@CMAKE_INSTALL_PREFIX@/@LIBRARY_DIRECTORY@
1+
includedir=@INCLUDE_DIRECTORY@
2+
libdir=@LIBRARY_DIRECTORY@
33

44
Name: @PROJECT_NAME@
55
Description: @PROJECT_DESCRIPTION@

0 commit comments

Comments
 (0)