jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.92k stars 1.78k forks source link

CMake uninstall target #1151

Closed duncanspumpkin closed 8 months ago

duncanspumpkin commented 1 year ago

The uninstall target in the project is always shown even if you don't have the install target. It should really be gated behind the ${YAML_CPP_INSTALL}. As a workaround in my projects I have been adding a dummy target before fetching yaml-cpp to prevent this:

# Get rid of yaml uninstall target
add_library(uninstall INTERFACE)

set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "")
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "")
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "")
set(YAML_BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(YAML_CPP_INSTALL OFF CACHE BOOL "")
set(YAML_CPP_FORMAT_SOURCE OFF CACHE BOOL "")
FetchContent_Declare(
    yaml-cpp
    GIT_REPOSITORY      https://github.com/jbeder/yaml-cpp
    GIT_TAG             1b50109f7bea60bd382d8ea7befce3d2bd67da5f
)

FetchContent_MakeAvailable(yaml-cpp)