diff options
Diffstat (limited to 'src/api/python/CMakeLists.txt')
-rw-r--r-- | src/api/python/CMakeLists.txt | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/api/python/CMakeLists.txt b/src/api/python/CMakeLists.txt index 74d1d84fc..96fcd67a0 100644 --- a/src/api/python/CMakeLists.txt +++ b/src/api/python/CMakeLists.txt @@ -95,13 +95,25 @@ target_include_directories(pycvc5 target_link_libraries(pycvc5 cvc5-shared) # Disable -Werror and other warnings for code generated by Cython. +set(PY_SRC_FLAGS "") +check_cxx_compiler_flag("-Werror" HAVE_CXX_FLAGWerror) +if(HAVE_CXX_FLAGWerror) + set(PY_SRC_FLAGS "${PY_SRC_FLAGS} -Wno-error") +endif() +check_cxx_compiler_flag("-Wshadow" HAVE_CXX_FLAGWshadow) +if(HAVE_CXX_FLAGWshadow) + set(PY_SRC_FLAGS "${PY_SRC_FLAGS} -Wno-shadow") +endif() +check_cxx_compiler_flag("-Wimplicit-fallthrough" HAVE_CXX_FLAGWimplicit_fallthrough) +if(HAVE_CXX_FLAGWimplicit_fallthrough) + set(PY_SRC_FLAGS "${PY_SRC_FLAGS} -Wno-implicit-fallthrough") +endif() # Note: Visibility is reset to default here since otherwise the PyInit_... # function will not be exported correctly # (https://github.com/cython/cython/issues/3380). set_target_properties(pycvc5 PROPERTIES - COMPILE_FLAGS - "-Wno-error -Wno-shadow -Wno-implicit-fallthrough" + COMPILE_FLAGS "${PY_SRC_FLAGS}" CXX_VISIBILITY_PRESET default VISIBILITY_INLINES_HIDDEN 0 LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pycvc5") |