How can I FetchContent with no warnings for developers (with -Wno-dev)?

309 Views Asked by At

I am trying to add zmq as a third party library with FetchContent. However, I am uninterested on the warnings meant for devs. As I have taken the tag for a verified release, it should be working without any errors or warnings ideally.

I do not want to have -Wno-dev for my whole CMake project configuration- only for my 3rd party libraries. I have not found a way to do it inside the CMakeLists.txt.

My code for FetchContent is:

FetchContent_Declare(
  libzmq
  GIT_REPOSITORY https://github.com/zeromq/libzmq.git
  GIT_TAG        v4.3.4
  OVERRIDE_FIND_PACKAGE
)

FetchContent_MakeAvailable(libzmq)

I also didn't find a version that have no warnings since v4.2.2 I have tested with BUILD_COMMAND or CONFIGURE_COMMAND but I found no solution through reading the documentation of CMake nor FetchContent

1

There are 1 best solutions below

3
starball On

I think you might be out of luck. From the FetchContent docs:

The <contentOptions> can be any of the download, update or patch options that the ExternalProject_Add() command understands.

Notice how configure and build options are not on that list (Ex. CMAKE_ARGS, CONFIGURE_COMMAND).

I looked through the list of CMake variables for one with "dev" and "warn" (usually when looking for directory-scoped overrides for these kinds of things, that's what you should do), and didn't find what you're looking for. There was CMAKE_WARN_DEPRECATED, but that's not the same (it's for the -Wno-deprecated/-Wdeprecated flags).