CMake ExternalProject_Add ignore dependency's cmake warnings
Asked Answered
C

0

6

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      "[email protected]: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?

Curhan answered 4/5, 2017 at 10:19 Comment(5)
Have you tried setting cmake_policy? Can you share what you have in the cmakelists?Euchromosome
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.Curhan
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")Euchromosome
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.Warm
can you provide details about the error you're getting? is it this?. Have you tried updating to [email protected]?Panoply

© 2022 - 2024 — McMap. All rights reserved.