CMakeLists.txt 826 B

1234567891011121314151617181920
  1. include_directories(${CMAKE_CURRENT_BINARY_DIR})
  2. add_library( Two TwoSrc.c )
  3. target_link_libraries( Two Three )
  4. # Setup a target to cause failure if Two does not depend on it or if
  5. # Two actually links to it. This will test that a utility dependency
  6. # on a library target works properly.
  7. add_custom_command(
  8. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/two-test.h
  9. COMMAND ${CMAKE_COMMAND} -E copy_if_different
  10. ${CMAKE_CURRENT_SOURCE_DIR}/two-test.h.in
  11. ${CMAKE_CURRENT_BINARY_DIR}/two-test.h
  12. DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/two-test.h.in
  13. )
  14. add_library( TwoCustom TwoCustomSrc.c ${CMAKE_CURRENT_BINARY_DIR}/two-test.h)
  15. set_target_properties(TwoCustom PROPERTIES EXCLUDE_FROM_ALL 1)
  16. target_link_libraries(TwoCustom Three)
  17. # Add a utility dependency to make sure it works without linking.
  18. add_dependencies(Two TwoCustom)