summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Ninja/LooseObjectDepends.cmake
blob: 360c7ba13c7fb5f5af45d22987919b853b82c998 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
cmake_minimum_required(VERSION 3.8)
project(LooseObjectDepends C)

add_custom_command(
  OUTPUT  "${CMAKE_CURRENT_BINARY_DIR}/command.h"
  COMMAND "${CMAKE_COMMAND}" -E touch
          "${CMAKE_CURRENT_BINARY_DIR}/command.h"
          COMMENT "Creating command.h")
add_custom_target(create-command.h
  DEPENDS
    "${CMAKE_CURRENT_BINARY_DIR}/command.h")

add_custom_target(create-target.h
  BYPRODUCTS  "${CMAKE_CURRENT_BINARY_DIR}/target.h"
  COMMAND "${CMAKE_COMMAND}" -E touch
          "${CMAKE_CURRENT_BINARY_DIR}/target.h"
  COMMENT "Creating target.h")

add_library(dep SHARED dep.c)
add_dependencies(dep create-command.h create-target.h)
target_include_directories(dep
  PUBLIC
    "${CMAKE_CURRENT_BINARY_DIR}")

add_library(top top.c)
target_link_libraries(top PRIVATE dep)