Skip to content

Commit 7a4eae8

Browse files
committed
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
1 parent 1dccd2a commit 7a4eae8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
2424
$<INSTALL_INTERFACE:include>)
2525

2626
find_package(CURL REQUIRED)
27-
target_link_libraries(${PROJECT_NAME} PRIVATE ${CURL_LIBRARIES})
27+
target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl)
2828
target_include_directories(${PROJECT_NAME} PRIVATE ${CURL_INCLUDE_DIRS})
2929

3030
target_compile_options(${PROJECT_NAME} PRIVATE

cmake/aws-lambda-runtime-config.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
include(CMakeFindDependencyMacro)
2+
3+
find_dependency(CURL)
4+
15
include(${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@-targets.cmake)
26

37
set(AWS_LAMBDA_PACKAGING_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/packager)

0 commit comments

Comments
 (0)