7

One of the libraries I'm using is giving a cmake warning for the developers of it. I'm trying to suppress that warning in my ExternalProject_Add with -Wno-dev

I tried setting it at:

  • CMAKE_ARGS
  • CMAKE_CACHE_ARGS
  • CMAKE_CACHE_DEFAULT_ARGS

This is the 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
        )

And I use it my main CMakeLists.txtlike this:

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)

So, far I haven't had any success suppressing the warning. How can I suppress developer cmake warnings through ExternalProject_Add?

RAM
  • 2,257
  • 2
  • 19
  • 41
ZeroPhase
  • 649
  • 4
  • 21
  • Have you tried setting cmake_policy? Can you share what you have in the cmakelists? – Tiago Cunha May 04 '17 at 10:45
  • Sure, I can post my CMakeLists. I just don't want to change the policy for my CMakeLists project for an external dependency with its own CMakeLists. – ZeroPhase May 04 '17 at 10:49
  • Usually the cmake call with -Wno-dev works to remove the warnings. Another workaround for this is to either declare a symbol called SYSTEM include_directories(SYSTEM "${LIB_DIR}/Include") which won't show any warnings at all. OR alternatively: SET(CMAKE_CXX_FLAGS "-isystem${MYPROJECT_MAIN_DIR}/include") – Tiago Cunha May 04 '17 at 10:55
  • As far as I understand the execution flow of your code, you use `ExternalProject_Add` for **download only**. But **actual using** of external project (`yaml-cpp` in your case) is performed via `add_subdirectory` approach. So you need to search decisions, suitable for `add_subdirectory` approach, `ExternalProject_Add` parameters are unrelated in that case. – Tsyvarev May 04 '17 at 11:28
  • can you provide details about the error you're getting? [is it this?](https://github.com/jbeder/yaml-cpp/blob/b57efe94e7d445713c29f863adb8c23438eaa217/CMakeLists.txt#L210). Have you tried updating to [yaml-cpp@0.7.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.7.0)? – starball Aug 02 '22 at 20:31

0 Answers0