From 7a4eae852dac98a643dbd12a4fb254af0e6eae0f Mon Sep 17 00:00:00 2001 From: Marco Magdy Date: Thu, 30 May 2019 07:38:18 +0000 Subject: [PATCH] Use the namespace package name for libcurl in CMake This is the proper way of going about package dependencies in CMake. It results in a package-config.cmake file that does not have hard-coded paths to the package from the machine it was built on. See https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html --- CMakeLists.txt | 2 +- cmake/aws-lambda-runtime-config.cmake | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f850b1..23e905f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC $) find_package(CURL REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE ${CURL_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl) target_include_directories(${PROJECT_NAME} PRIVATE ${CURL_INCLUDE_DIRS}) target_compile_options(${PROJECT_NAME} PRIVATE diff --git a/cmake/aws-lambda-runtime-config.cmake b/cmake/aws-lambda-runtime-config.cmake index 4fc08da..2d39432 100644 --- a/cmake/aws-lambda-runtime-config.cmake +++ b/cmake/aws-lambda-runtime-config.cmake @@ -1,3 +1,7 @@ +include(CMakeFindDependencyMacro) + +find_dependency(CURL) + include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake) set(AWS_LAMBDA_PACKAGING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/packager)