RetrieveDependencies.cmake 370 B

12345678910111213141516
  1. cmake_minimum_required(VERSION 3.7)
  2. project(RetrieveDependencies C)
  3. add_library(a a.c)
  4. add_library(b c.c)
  5. target_link_libraries(a b)
  6. add_library(c c.c)
  7. add_dependencies(a c)
  8. get_property(DEPS_A TARGET a PROPERTY MANUALLY_ADDED_DEPENDENCIES)
  9. if(NOT DEPS_A STREQUAL "c")
  10. message(FATAL_ERROR "Expected target c being a dependency of a but got: '${DEPS_A}'")
  11. endif()