You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
730 B

2 months ago
  1. cmake_minimum_required(VERSION 3.5)
  2. project(yaml-cpp-consumer LANGUAGES CXX)
  3. find_package(yaml-cpp CONFIG REQUIRED)
  4. get_target_property(LIBRARY_TYPE yaml-cpp::yaml-cpp TYPE)
  5. if(LIBRARY_TYPE STREQUAL "SHARED_LIBRARY")
  6. if(NOT YAML_CPP_SHARED_LIBS_BUILT)
  7. message(FATAL_ERROR "Library type (${LIBRARY_TYPE}) contradicts config: ${YAML_CPP_SHARED_LIBS_BUILT}")
  8. endif()
  9. else()
  10. if(YAML_CPP_SHARED_LIBS_BUILT)
  11. message(FATAL_ERROR "Library type (${LIBRARY_TYPE}) contradicts config: ${YAML_CPP_SHARED_LIBS_BUILT}")
  12. endif()
  13. endif()
  14. add_executable(main main.cpp)
  15. if (NOT DEFINED CMAKE_CXX_STANDARD)
  16. set_target_properties(main PROPERTIES CXX_STANDARD 11)
  17. endif()
  18. target_link_libraries(main PRIVATE ${YAML_CPP_LIBRARIES})