summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-03-31 16:01:37 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2017-03-31 16:01:37 +0000
commit9de7386f6f029985e65e02a1d98240f6808020aa (patch)
tree42f49bfc9ea36d339e9eaf9136c81cd224056991 /plugin
parenta00517ac9707ffd51c092f5af5d198c5ee789bb4 (diff)
downloadmariadb-git-9de7386f6f029985e65e02a1d98240f6808020aa.tar.gz
AWS KMS plugin : Fix building in case AWS C++ SDK was preinstalled
into non-standard compiler/linker path (e.g vcpkg on Windows). Also fix linking with static preinstalled aws c++ sdk libraries
Diffstat (limited to 'plugin')
-rw-r--r--plugin/aws_key_management/CMakeLists.txt24
1 files changed, 14 insertions, 10 deletions
diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt
index 62d359569c6..31ddcd7e038 100644
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@ -61,10 +61,11 @@ ENDIF()
FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS})
-CHECK_INCLUDE_FILE_CXX(aws/kms/KMSClient.h HAVE_AWS_HEADERS)
+FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h)
-IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND HAVE_AWS_HEADERS)
- # AWS C++ SDK installed
+IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR)
+ # AWS C++ SDK installed
+ INCLUDE_DIRECTORIES(${AWS_CPP_SDK_INCLUDE_DIR})
SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS})
ELSE()
# Build from source, using ExternalProject_Add
@@ -95,7 +96,7 @@ ELSE()
ENDIF()
ENDIF()
IF(MSVC)
- SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" "-DCMAKE_CXX_FLAGS=/wd4530 /WX-")
+ SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" "-DCMAKE_CXX_FLAGS=/wd4530 /wd4577 /WX-")
ENDIF()
IF(CMAKE_CXX_COMPILER)
SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
@@ -128,11 +129,6 @@ ELSE()
ADD_DEPENDENCIES(${lib} aws_sdk_cpp)
SET(loc "${CMAKE_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
- IF(WIN32)
- SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "bcrypt;winhttp;wininet;userenv")
- ELSE()
- SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${SSL_LIBRARIES};${CURL_LIBRARIES};${UUID_LIBRARIES}")
- ENDIF()
ENDFOREACH()
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -145,4 +141,12 @@ ENDIF()
ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
-TARGET_LINK_LIBRARIES(aws_key_management ${AWS_SDK_LIBS})
+
+IF(WIN32)
+ SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version)
+ELSE()
+ SET(AWS_CPP_SDK_DEPENDENCIES ${SSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
+ENDIF()
+
+TARGET_LINK_LIBRARIES(aws_key_management ${AWS_SDK_LIBS} ${AWS_CPP_SDK_DEPENDENCIES})
+