Skip to content

Commit 352dc32

Browse files
committed
Make sure win and osx flags are set correctly
1 parent a05d25a commit 352dc32

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ project(duckdb_py LANGUAGES CXX)
44

55
# Always use C++11
66
set(CMAKE_CXX_STANDARD 11)
7+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8+
set(CMAKE_CXX_EXTENSIONS OFF)
79

810
# Set the library name
911
set(DUCKDB_PYTHON_LIB_NAME "_duckdb")

cmake/duckdb_loader.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ function(_duckdb_create_interface_target target_name)
147147
$<$<CONFIG:Debug>:DUCKDB_DEBUG_MODE>
148148
)
149149

150+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
151+
target_compile_options(${target_name} INTERFACE
152+
/wd4244 # suppress Conversion from 'type1' to 'type2', possible loss of data
153+
/wd4267 # suppress Conversion from ‘size_t’ to ‘type’, possible loss of data
154+
/wd4200 # suppress Nonstandard extension used: zero-sized array in struct/union
155+
/wd26451 /wd26495 # suppress Code Analysis
156+
/D_CRT_SECURE_NO_WARNINGS # suppress warnings about unsafe functions
157+
/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR # see https://github.com/duckdblabs/duckdb-internal/issues/5151
158+
/utf-8 # treat source files as UTF-8 encoded
159+
)
160+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
161+
target_compile_options(${target_name} INTERFACE
162+
-stdlib=libc++ # for libc++ in favor of older libstdc++
163+
-mmacosx-version-min=10.7 # minimum osx version compatibility
164+
)
165+
endif()
166+
150167
# Link to the DuckDB static library
151168
target_link_libraries(${target_name} INTERFACE duckdb_static)
152169

0 commit comments

Comments
 (0)