nanodbc: Remove extra CXX flags from the build

nanodbc was overriding the C++ standard library being used, which would
break builds with clang. Additionally, adding Werror unconditionally in
production code is a bad idea because different compiler versions can
change/add warnings and then break the code.
This commit is contained in:
Ian McInerney 2022-09-23 23:55:19 +01:00
parent 201b45b41a
commit 69a6ddae03
1 changed files with 1 additions and 14 deletions

View File

@ -26,20 +26,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "nanodbc compile: C++${CMAKE_CXX_STANDARD}")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wnarrowing -Werror")
include(CheckCXXCompilerFlag)
if(NOT NANODBC_DISABLE_LIBCXX)
check_cxx_compiler_flag("-stdlib=libc++" CXX_SUPPORTS_STDLIB)
if(CXX_SUPPORTS_STDLIB)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++")
endif()
set(NANODBC_DISABLE_LIBCXX ${NANODBC_DISABLE_LIBCXX} CACHE BOOL "Do not use libc++, if available." FORCE)
endif()
message(STATUS "nanodbc build: Disable linking libc++ - ${NANODBC_DISABLE_LIBCXX}")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
string(REGEX REPLACE "[/-]W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if (NOT (CMAKE_VERSION VERSION_LESS 3.6.0)) # Compiler features for Intel in CMake 3.6+
@ -202,4 +189,4 @@ endif()
if(NANODBC_ENABLE_UNICODE)
add_compile_definitions(NANODBC_ENABLE_UNICODE)
target_compile_definitions(nanodbc PUBLIC NANODBC_ENABLE_UNICODE)
endif()
endif()