Skip to content

Commit

Permalink
build: Set -DUSE_IMPORT_EXPORT in pkgconfig files on Windows
Browse files Browse the repository at this point in the history
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.

Related to amzn/amazon-s3-gst-plugin#13
  • Loading branch information
nirbheek committed Jan 9, 2022
1 parent 8a1cf0d commit e901445
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ 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)
Expand Down
2 changes: 1 addition & 1 deletion toolchains/pkg-config.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ libdir=@CMAKE_INSTALL_PREFIX@/@PKG_CONFIG_LIB_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@

0 comments on commit e901445

Please sign in to comment.