Skip to content

Commit 56da864

Browse files
committed
Fix issue awslabs#15 by fixing aws-c-common installs
`aws-c-event-stream` should not need to worry nor now how to find the `aws-c-common` CMake modules. This can be fixed by simply moving up `find_package(aws-c-common REQUIRED)` and making the `aws-c-common` package set the paths correctly. This has been confirmed to work on amazon linux 2. This commit requires awslabs/aws-c-common#587 to be merged first.
1 parent 3bc3366 commit 56da864

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

CMakeLists.txt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,13 @@
1313
cmake_minimum_required (VERSION 3.1)
1414
project (aws-c-event-stream C)
1515

16-
if (DEFINED CMAKE_PREFIX_PATH)
17-
file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
18-
endif()
19-
20-
if (DEFINED CMAKE_INSTALL_PREFIX)
21-
file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
22-
endif()
23-
2416
if (UNIX AND NOT APPLE)
2517
include(GNUInstallDirs)
2618
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
2719
set(CMAKE_INSTALL_LIBDIR "lib")
2820
endif()
29-
30-
# This is required in order to append /lib/cmake to each element in CMAKE_PREFIX_PATH
31-
set(AWS_MODULE_DIR "/${CMAKE_INSTALL_LIBDIR}/cmake")
32-
string(REPLACE ";" "${AWS_MODULE_DIR};" AWS_MODULE_PATH "${CMAKE_PREFIX_PATH}${AWS_MODULE_DIR}")
33-
# Append that generated list to the module search path
34-
list(APPEND CMAKE_MODULE_PATH ${AWS_MODULE_PATH})
21+
find_package(aws-c-common REQUIRED)
22+
find_package(aws-checksums REQUIRED)
3523

3624
include(AwsCFlags)
3725
include(AwsSharedLibSetup)
@@ -83,8 +71,6 @@ target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
8371
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VERSION 1.0.0)
8472
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES SOVERSION 0unstable)
8573

86-
find_package(aws-c-common REQUIRED)
87-
find_package(aws-checksums REQUIRED)
8874

8975
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC AWS::aws-c-common AWS::aws-checksums)
9076

0 commit comments

Comments
 (0)