Skip to content
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
2 changes: 1 addition & 1 deletion FindGrpc.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include("GenericFindDependency")

option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features (e.g. cxx_std_11) that propagate to targets that link to Abseil" true)
option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features (e.g. cxx_std_14) that propagate to targets that link to Abseil" true)
option(protobuf_INSTALL "Install protobuf binaries and files" OFF)
option(utf8_range_ENABLE_INSTALL "Configure installation" OFF)

Expand Down
3 changes: 2 additions & 1 deletion FindProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
#

option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features (e.g. cxx_std_14) that propagate to targets that link to Abseil" true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protobuf now has abseil, hence the need for this. I believe in the very latest version they've removed abseil, but we aren't there yet.

option(protobuf_INSTALL "Install protobuf binaries and files" OFF)
option(utf8_range_ENABLE_INSTALL "Configure installation" OFF)

include("GenericFindDependency")
option(protocol_BUILD_TESTS "" OFF)
GenericFindDependency(
TARGET "libprotobuf"
SOURCE_DIR "protobuf/cmake"
SOURCE_DIR "protobuf"
SYSTEM_INCLUDES
)
3 changes: 3 additions & 0 deletions SwiftTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ function(swift_add_target target type)
if (x_C_STANDARD)
list(APPEND language_standards_args C ${x_C_STANDARD})
endif()

if (x_CXX_STANDARD)
list(APPEND language_standards_args CXX ${x_CXX_STANDARD})
elseif (SWIFT_CXX_STANDARD)
list(APPEND language_standards_args CXX ${SWIFT_CXX_STANDARD})
Comment on lines 254 to +257
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here if the caller specified the CXX_STANDARD it prioritizes that over the global variable SWIFT_CXX_STANDARD

endif()

if (x_INTERFACE AND x_OBJECT)
Expand Down
14 changes: 12 additions & 2 deletions TestTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ endfunction()

function(swift_add_test target)
set(argOption "INTEGRATION_TEST" "PARALLEL" "POST_BUILD" "UNIT_TEST" "VALGRIND_MEMCHECK")
set(argSingle "COMMENT" "WORKING_DIRECTORY")
set(argSingle "C_STANDARD" "CXX_STANDARD" "COMMENT" "WORKING_DIRECTORY")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can not set the C++ standard used by the test code via the function call

set(argMulti "SRCS" "LINK" "INCLUDE")

cmake_parse_arguments(x "${argOption}" "${argSingle}" "${argMulti}" ${ARGN})
Expand Down Expand Up @@ -290,9 +290,19 @@ function(swift_add_test target)
message(FATAL_ERROR "VALGRIND_MEMCHECK can only be specified with UNIT_TEST")
endif()

set(language_standards_args)
if (x_C_STANDARD)
list(APPEND language_standards_args C ${x_C_STANDARD})
endif()
if (x_CXX_STANDARD)
list(APPEND language_standards_args CXX ${x_CXX_STANDARD})
elseif (SWIFT_CXX_STANDARD)
list(APPEND language_standards_args CXX ${SWIFT_CXX_STANDARD})
endif()

add_executable(${target} EXCLUDE_FROM_ALL ${x_SRCS})
set_target_properties(${target} PROPERTIES SWIFT_TYPE "test")
swift_set_language_standards(${target} C_EXTENSIONS_ON)
swift_set_language_standards(${target} ${language_standards_args} C_EXTENSIONS_ON)
target_code_coverage(${target} AUTO ALL)
if(x_INCLUDE)
target_include_directories(${target} PRIVATE ${x_INCLUDE})
Expand Down