fix ixsentry detection of std::regex

This commit is contained in:
Benjamin Sergeant 2020-11-16 09:19:08 -08:00
parent 866670a906
commit ea32c0e1ec

View File

@ -2,17 +2,6 @@
# Author: Benjamin Sergeant
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
#
include(CheckCSourceCompiles)
check_c_source_compiles("#include <regex>
int main()
{
const std::regex dsnRegex;
std::smatch group;
std::regex_match(std::string(), group, dsnRegex);
return 0;
}"
HAVE_STD_REGEX)
set (IXSENTRY_SOURCES
ixsentry/IXSentryClient.cpp
@ -27,6 +16,20 @@ add_library(ixsentry STATIC
${IXSENTRY_HEADERS}
)
#
# Using try_compile or other techniques to detect std::regex
# availability is hard, so resorting to an ugly compiler and compiler
# version check.
#
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
else()
target_compile_definitions( ixsentry PUBLIC HAVE_STD_REGEX=1 )
endif()
else()
target_compile_definitions( ixsentry PUBLIC HAVE_STD_REGEX=1 )
endif()
find_package(JsonCpp)
if (NOT JSONCPP_FOUND)
set(JSONCPP_INCLUDE_DIRS ../third_party/jsoncpp)
@ -39,7 +42,3 @@ set(IXSENTRY_INCLUDE_DIRS
${JSONCPP_INCLUDE_DIRS})
target_include_directories( ixsentry PUBLIC ${IXSENTRY_INCLUDE_DIRS} )
if (HAVE_STD_REGEX)
target_compile_definitions( ixsentry PUBLIC HAVE_STD_REGEX=1 )
endif()