From 6861039f2cc03393d87703667e9cc9276b41c577 Mon Sep 17 00:00:00 2001 From: saraboule Date: Mon, 3 Jul 2023 16:27:15 -0400 Subject: [PATCH] added in Nirbheek's patches from https://github.com/aws/aws-sdk-cpp/pull/1839 --- CMakeLists.txt | 16 ++++++++++++++++ toolchains/pkg-config.pc.in | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d1f35c4efc..d02a349f1fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,6 +290,22 @@ if (LEGACY_BUILD) set(ARCHIVE_DIRECTORY "${LIBRARY_DIRECTORY}") endif () + # We need to point this to the directory containing import libraries or static + # libraries on Windows, and to the directory containing the so / dylib + # libraries on other platforms. + if(WIN32) + set(PKG_CONFIG_LIB_DIRECTORY "${ARCHIVE_DIRECTORY}") + else() + set(PKG_CONFIG_LIB_DIRECTORY "${LIBRARY_DIRECTORY}") + endif() + + # MSVC consumers of the shared library need to define this macro when linking + # to aws-cpp-sdk-* libs, or they will get undefined reference errors. Also + # doesn't hurt to define this with MinGW, so add it unconditionally on Windows. + if(WIN32 AND BUILD_SHARED_LIBS) + set(PKG_CONFIG_EXPORT_CFLAGS "-DUSE_IMPORT_EXPORT") + endif() + if (ENABLE_ADDRESS_SANITIZER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g -fno-omit-frame-pointer") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.1) diff --git a/toolchains/pkg-config.pc.in b/toolchains/pkg-config.pc.in index 9b519d2772b..dc4264f2d33 100644 --- a/toolchains/pkg-config.pc.in +++ b/toolchains/pkg-config.pc.in @@ -4,7 +4,7 @@ libdir=@CMAKE_INSTALL_PREFIX@/@LIBRARY_DIRECTORY@ Name: @PROJECT_NAME@ Description: @PROJECT_DESCRIPTION@ Version: @PROJECT_VERSION@ -Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@ +Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@ @PKG_CONFIG_EXPORT_CFLAGS@ Libs: -L${libdir} -l@PROJECT_NAME@ Libs.private: @ALL_DEP_LIBS_LINK_FLAGS@ Requires: @PROJECT_LIBS_STRING@