Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
363168a
add option to directly support narrow strings on win32
jason-ha Jul 10, 2019
3574455
refactor strings_utils from asyncrt_utils
jason-ha Jul 19, 2019
be44557
temp rename asyncrt_utils for split preserving history
jason-ha Jul 19, 2019
76e9ad1
merge for asyncrt_utils split
jason-ha Jul 19, 2019
926f431
refactor memory_utils from asyncrt_utils
jason-ha Jul 19, 2019
dec33c5
merge for asyncrt_utils split
jason-ha Jul 19, 2019
2479267
breakout pieces of asyncrt_utils enabling custom building of select c…
jason-ha Jul 19, 2019
f4f3f94
add <memory> includes in header with explicit dependencies
jason-ha Jul 23, 2019
665e00e
add <typeinfo> include for bad_cast in string_utils.h
jason-ha Jul 23, 2019
df2bbe9
add <algorithm> for std::count in nonce_generator_tests.cpp
jason-ha Jul 23, 2019
d2ad866
nudge pipeline to rerun
jason-ha Jul 23, 2019
71dea74
Add CPPREST_USE_STRING_VIEWS option to accept string_views as input
jason-ha Aug 1, 2019
8c79add
Specify pipeline build options for CPPREST_USE_STRING_VIEWS
jason-ha Aug 1, 2019
1dd421a
provide overload guidance for to_utf8/16string
jason-ha Aug 3, 2019
252889b
account for C++11 standard default for some toolsets
jason-ha Aug 3, 2019
1db8208
suppress errorneous MSVC [15.6,16.0) C++17 deprecation warnings with …
jason-ha Aug 3, 2019
097873d
alternate MSVC warning suppression
jason-ha Aug 5, 2019
ddd8d60
Merge remote-tracking branch 'origin/master' into jason-ha/win32_narr…
BillyONeal Aug 23, 2019
357d3b7
remove CPPREST_FORCE_NARROW_STRINGS option
jason-ha Aug 23, 2019
1c5f829
nudge pipeline to rerun
jason-ha Aug 26, 2019
697050f
nudge pipeline to rerun
jason-ha Aug 26, 2019
561e19e
Merge remote-tracking branch 'origin/master' into jason-ha/win32_narr…
jason-ha Aug 28, 2019
1aa685d
Merge branch 'win32_narrow_strings' into improved_string_width_ifdef
jason-ha Aug 28, 2019
c2ba29e
Merge remote-tracking branch 'jason-ha/improved_string_width_ifdef' i…
jason-ha Aug 28, 2019
5957e3a
nudge pipeline to rerun
jason-ha Aug 30, 2019
2b20cb8
Merge remote-tracking branch 'origin/master' into jason-ha/win32_narr…
jason-ha Feb 13, 2020
eca7bd1
Merge branch 'win32_narrow_strings' into improved_string_width_ifdef
jason-ha Feb 13, 2020
350bca3
Merge remote-tracking branch 'jason-ha/improved_string_width_ifdef' i…
jason-ha Feb 13, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Intermediate/
# Ignore cmake building directories
build.*/
docs/
out/
# Ignore NuGet artifacts
.nuget/
Build_android/build/
Expand Down
51 changes: 48 additions & 3 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,37 @@ set(CPPREST_VERSION_MAJOR 2)
set(CPPREST_VERSION_MINOR 10)
set(CPPREST_VERSION_REVISION 14)

# Note: when bumping CMake version to 3.3 or higher if(... IN_LIST ...) may be used
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_17 COMPILER_HAS_CXX_STD_17)
set(CPPREST_USE_STRING_VIEWS_DEFAULT_PER_CXX_STANDARD OFF)
if(COMPILER_HAS_CXX_STD_17 EQUAL "-1")
if(CPPREST_USE_STRING_VIEWS)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(FATAL_ERROR "CPPREST_USE_STRING_VIEWS cannot be enabled. CMake 3.8 or higher required to support C++17.")
else()
message(FATAL_ERROR "CPPREST_USE_STRING_VIEWS cannot be enabled. Compiler (${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}) does not support C++17.")
endif()
endif()
elseif(CMAKE_CXX_STANDARD LESS 17)
if(CPPREST_USE_STRING_VIEWS)
message(FATAL_ERROR "CPPREST_USE_STRING_VIEWS cannot be enabled when C++ standard is less than 17")
endif()
elseif((NOT CMAKE_CXX_STANDARD GREATER 16.99) AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR IOS OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
if(CPPREST_USE_STRING_VIEWS)
message(FATAL_ERROR "CPPREST_USE_STRING_VIEWS cannot be enabled without setting C++ standard to 17 or greater for current configuration") # see compiler specific settings below
endif()
else()
set(CPPREST_USE_STRING_VIEWS_DEFAULT_PER_CXX_STANDARD ON)
endif()

enable_testing()

set(WERROR ON CACHE BOOL "Treat Warnings as Errors.")
set(CPPREST_EXCLUDE_WEBSOCKETS OFF CACHE BOOL "Exclude websockets functionality.")
set(CPPREST_EXCLUDE_COMPRESSION OFF CACHE BOOL "Exclude compression functionality.")
set(CPPREST_EXCLUDE_BROTLI ON CACHE BOOL "Exclude Brotli compression functionality.")
set(CPPREST_EXPORT_DIR cpprestsdk CACHE STRING "Directory to install CMake config files.")
option(CPPREST_USE_STRING_VIEWS "Use string_view types" ${CPPREST_USE_STRING_VIEWS_DEFAULT_PER_CXX_STANDARD})
set(CPPREST_INSTALL_HEADERS ON CACHE BOOL "Install header files.")
set(CPPREST_INSTALL ON CACHE BOOL "Add install commands.")

Expand Down Expand Up @@ -116,6 +140,11 @@ endif()
set(WARNINGS)
set(ANDROID_LIBS)

# Generic build settings
if(CPPREST_USE_STRING_VIEWS)
add_definitions(-DCPPREST_USE_STRING_VIEWS)
endif()

# Platform (not compiler) specific settings
if(ANDROID)
# These are used in the shared library case
Expand All @@ -140,6 +169,15 @@ else()
endif()

# Compiler (not platform) specific settings
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR IOS OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(NOT CMAKE_CXX_STANDARD GREATER 0)
if(CPPREST_USE_STRING_VIEWS)
message(FATAL_ERROR "internal cpprestsdk cmake error: CPPREST_USE_STRING_VIEWS ON while C++ standard not set")
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR IOS)
message("-- Setting clang options")

Expand All @@ -157,18 +195,18 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR IOS)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++${CMAKE_CXX_STANDARD}")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")

elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
message("-- Setting gcc options")

set(WARNINGS -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code)
set(LD_FLAGS "${LD_FLAGS} -Wl,-z,defs")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -D_GLIBCXX_USE_SCHED_YIELD -D_GLIBCXX_USE_NANOSLEEP")
endif()
Expand All @@ -193,6 +231,13 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/permissive-)
endif()
endif()

# Suppress C++17 deprecation warning in aiso per https://github.com/chriskohlhoff/asio/issues/290#issuecomment-371867040
# MSVC has addressed issue in 16.0 per https://devblogs.microsoft.com/cppblog/cpp17-20-features-and-fixes-in-vs-2019/
if(MSVC_VERSION GREATER 1912 AND MSVC_VERSION LESS 1920)
add_definitions(-D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING)
endif()

else()
message("-- Unknown compiler, success is doubtful.")
message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")
Expand Down
Loading