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