[man] silence warnings for gperf generating code with 0 for null pointers

parent 3f1e20c0
......@@ -2,6 +2,16 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kio5_man\")
find_package(KF5 REQUIRED COMPONENTS Codecs)
# silence warnings for gperf generating code with 0 for null pointers
set(AVOID_NULLPTR_WARNING_FLAG)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(_flag "-Wno-zero-as-null-pointer-constant")
check_cxx_compiler_flag(${_flag} _flag_present)
if(_flag_present)
set(AVOID_NULLPTR_WARNING_FLAG ${_flag})
endif()
endif()
if(BUILD_TESTING)
add_subdirectory( tests )
endif()
......@@ -12,6 +22,10 @@ set(kio_man_PART_SRCS man2html.cpp kio_man.cpp request_hash.cpp kio_man_debug.cp
ecm_gperf_generate(requests.gperf ${CMAKE_CURRENT_BINARY_DIR}/request_gperf.h kio_man_PART_SRCS)
add_library(kio_man MODULE ${kio_man_PART_SRCS})
if (AVOID_NULLPTR_WARNING_FLAG)
target_compile_options(kio_man PRIVATE ${AVOID_NULLPTR_WARNING_FLAG})
endif()
target_link_libraries(kio_man KF5::KIOCore Qt5::Widgets KF5::Archive KF5::I18n KF5::Codecs Qt5::Network)
set_target_properties(kio_man PROPERTIES OUTPUT_NAME "man")
install(TARGETS kio_man DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kio)
......
......@@ -16,6 +16,10 @@ add_executable(kio_man_test ${kio_man_test_SRCS})
ecm_mark_as_test(kio_man_test)
set_target_properties(kio_man_test PROPERTIES COMPILE_FLAGS "-DSIMPLE_MAN2HTML -DKIO_MAN_TEST")
target_link_libraries(kio_man_test Qt5::Widgets KF5::I18n KF5::KIOCore KF5::Archive KF5::Codecs Qt5::Network)
if (AVOID_NULLPTR_WARNING_FLAG)
target_compile_options(kio_man_test PRIVATE ${AVOID_NULLPTR_WARNING_FLAG})
endif()
########### next target ###############
......@@ -31,3 +35,6 @@ add_executable(man2html ${man2html_SRCS})
ecm_mark_as_test(man2html)
set_target_properties(man2html PROPERTIES COMPILE_FLAGS -DSIMPLE_MAN2HTML)
target_link_libraries(man2html Qt5::Core KF5::Codecs KF5::Archive)
if (AVOID_NULLPTR_WARNING_FLAG)
target_compile_options(man2html PRIVATE ${AVOID_NULLPTR_WARNING_FLAG})
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment