Printing a package property in CMake

By example of spdlog package:

find_package(spdlog 1.13.0 EXACT REQUIRED)

message("spdlog_FOUND: ${spdlog_FOUND}")

get_property(SPDLOG_INTERFACE_INCLUDE_DIRECTORIES TARGET spdlog::spdlog_header_only PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Location of spdlog: ${SPDLOG_INTERFACE_INCLUDE_DIRECTORIES}")

2 Responses to Printing a package property in CMake

  1. dmitriano says:

    How to print all the properties of a target in cmake?
    https://stackoverflow.com/a/34292622/2394762

  2. dmitriano says:

    CMake Warning (dev) at CMake/AwlLink.cmake:97 (find_package):
    Policy CMP0074 is not set: find_package uses _ROOT variables.
    Run “cmake –help-policy CMP0074” for policy details. Use the cmake_policy
    command to set the policy and suppress this warning.

    Environment variable spdlog_ROOT is set to:

    /home/dmitriano/dev/libs/spdlog

    For compatibility, CMake is ignoring the variable.

Leave a Reply

Your email address will not be published. Required fields are marked *