Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPP: Cleanup makefiles #6139

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions cpp/example_code/lambda/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ if(NOT GTest_FOUND)
FetchContent_MakeAvailable(googletest)
endif()

# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})

# Set the location for Windows to find the installed libraries of the SDK.
if(MSVC)
if(WINDOWS_BUILD)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif()
Expand All @@ -48,24 +51,24 @@ add_executable(

# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if(MSVC AND BUILD_SHARED_LIBS)

set(CMAKE_BUILD_TYPE Debug) # Explicitly setting CMAKE_BUILD_TYPE is necessary in Windows to copy DLLs.
if(WINDOWS_BUILD)
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR}
)

add_custom_command(
TARGET
${CURRENT_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${CMAKE_BUILD_TYPE}/gtest.dll
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
TARGET
${CURRENT_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}${BIN_SUB_DIR}/gtest.dll
${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR}
)
endif()

Expand All @@ -79,19 +82,8 @@ if (NOT DEFINED GTEST_SOURCE_FILES)
)
endif()

# Check whether the target system is Windows, including Win64.
if(WIN32)
list(FILTER GTEST_SOURCE_FILES EXCLUDE REGEX "/gtest_list_buckets_disabling_dns_cache.cpp$") # Not supported in windows, see file for details

# Check whether the compiler is some version of Microsoft Visual C++, or another compiler simulating C++.
if(MSVC)
source_group("Source Files" FILES ${GTEST_SOURCE_FILES})
endif(MSVC)
endif()

enable_testing()


foreach(TEST_FILE ${GTEST_SOURCE_FILES})
string(REPLACE "gtest_" "../" SOURCE_FILE ${TEST_FILE})
if (EXISTS ${SOURCE_FILE})
Expand Down
Loading