7

我正在使用的库之一是向它的开发人员发出 cmake 警告。我试图在我ExternalProject_Add的 with中压制那个警告-Wno-dev

我尝试将其设置为:

  • CMAKE_ARGS
  • CMAKE_CACHE_ARGS
  • CMAKE_CACHE_DEFAULT_ARGS

这是 yaml-cpp.txt.in:

cmake_minimum_required(VERSION 3.5)
project(yaml-cpp-download NONE)

include(ExternalProject)
ExternalProject_Add(tinyxml2
        GIT_REPOSITORY      "git@github.com:jbeder/yaml-cpp.git"
        GIT_TAG             "yaml-cpp-0.5.3"
        SOURCE_DIR          "${CMAKE_BINARY_DIR}/yaml-cpp-src"
        BINARY_DIR          "${CMAKE_BINARY_DIR}/yaml-cpp-build"
        CONFIGURE_COMMAND   "" 
        BUILD_COMMAND       ""
        INSTALL_COMMAND     ""
        TEST_COMMAND        ""
        CMAKE_ARGS          -Wno-dev
        )

我主要CMakeLists.txt这样使用它:

macro(Libraries arg)
    configure_file(CMakeDownloadPackages/${arg}.txt.in
            ${arg}-download/CMakeLists.txt)
    execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${arg}-download)
    execute_process(COMMAND ${CMAKE_COMMAND} --build .
            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${arg}-download)
    add_subdirectory(${CMAKE_BINARY_DIR}/${arg}-src
            ${CMAKE_BINARY_DIR}/${arg}-build)
endmacro()
Libraries(yaml-cpp)

所以,到目前为止,我还没有成功压制警告。如何通过 ExternalProject_Add 抑制开发人员 cmake 警告?

4

0 回答 0