Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: build problems with MSVC #288

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

Merged
merged 2 commits into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

cmake_minimum_required(VERSION 3.10)

if (NOT (CMAKE_VERSION VERSION_LESS "3.14"))
cmake_policy(SET CMP0091 NEW)
endif ()

set(PACKAGE_BUGREPORT
"http://github.com/GoogleCloudPlatform/functions-framework-cpp")
project(
Expand All @@ -30,6 +34,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

if (VCPKG_TARGET_TRIPLET MATCHES "-static$")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else ()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif ()

include(CTest)
include(FunctionsFrameworkCppHelpers)
add_subdirectory(google/cloud/functions)
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ functions_framework_cpp_add_common_options(functions_framework_examples)
if (MSVC)
set_property(
SOURCE site/tips_gcp_apis/tips_gcp_apis.cc site/env_vars/env_vars.cc
site/tutorial_cloud_spanner/tutorial_cloud_spanner.cc
APPEND
PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
endif ()
Expand Down
6 changes: 6 additions & 0 deletions examples/site/testing_pubsub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ if (BUILD_TESTING)
target_link_libraries(
pubsub_system_test PRIVATE google-cloud-cpp::pubsub fmt::fmt Boost::log
GTest::gmock_main GTest::gmock GTest::gtest)
if (MSVC)
set_property(
SOURCE pubsub_system_test.cc
APPEND
PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
endif ()
endif ()
6 changes: 6 additions & 0 deletions examples/site/testing_storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ if (BUILD_TESTING)
storage_system_test
PRIVATE google-cloud-cpp::storage fmt::fmt Boost::log GTest::gmock_main
GTest::gmock GTest::gtest)
if (MSVC)
set_property(
SOURCE storage_system_test.cc
APPEND
PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
endif ()
endif ()
2 changes: 1 addition & 1 deletion examples/site_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ lUtj+/nH3HDQjM4ltYfTPUg=
std::ofstream(filename) << keyfile.dump() << "\n";

google::cloud::functions_internal::SetEnv("GOOGLE_APPLICATION_CREDENTIALS",
filename);
filename.string());
EXPECT_THROW(bearer_token(gcf::HttpRequest{}), std::exception);

EXPECT_NO_THROW(
Expand Down
1 change: 1 addition & 0 deletions google/cloud/functions/internal/base64_decode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "google/cloud/functions/internal/base64_decode.h"
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <stdexcept>

namespace google::cloud::functions_internal {
inline namespace FUNCTIONS_FRAMEWORK_CPP_NS {
Expand Down