cmake_policy(SET CMP0116 NEW) enable_language(C) add_custom_command( OUTPUT topcc.c DEPFILE topcc_$.c.d COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc_$.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" ) add_custom_target(topcc ALL DEPENDS topcc.c) add_custom_command( OUTPUT topexe.c DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/topexe_$.c.d COMMAND ${CMAKE_COMMAND} -DOUTFILE=topexe.c "-DINFILE=${CMAKE_CURRENT_BINARY_DIR}/topexedep.txt" -DDEPFILE=topexe_$.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" ) add_executable(topexe "${CMAKE_CURRENT_BINARY_DIR}/topexe.c") add_custom_command( OUTPUT toplib.c DEPFILE toplib.c.d COMMAND ${CMAKE_COMMAND} -DOUTFILE=toplib.c -DINFILE=toplibdep.txt -DDEPFILE=toplib.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake" ) add_library(toplib STATIC toplib.c) add_subdirectory(DepfileSubdir) set(TEST_SPACE 1) if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) if(NOT res EQUAL 0 OR NOT out MATCHES "GNU") set(TEST_SPACE 0) endif() endif() if(TEST_SPACE) add_subdirectory(DepfileSubdirWithSpace) endif() add_custom_command( OUTPUT toplib2.c DEPFILE toplib2.c.d COMMAND ${CMAKE_COMMAND} -DOUTFILE=toplib2.c -DINFILE=toplibdep2.txt -DDEPFILE=toplib2.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile2.cmake" ) add_library(toplib2 STATIC toplib2.c) file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$>.cmake CONTENT " function(check_exists file) if(NOT EXISTS \"\${file}\") string(APPEND RunCMake_TEST_FAILED \"\${file} does not exist\\n\") endif() set(RunCMake_TEST_FAILED \"\${RunCMake_TEST_FAILED}\" PARENT_SCOPE) endfunction() function(check_not_exists file) if(EXISTS \"\${file}\") string(APPEND RunCMake_TEST_FAILED \"\${file} exists\\n\") endif() set(RunCMake_TEST_FAILED \"\${RunCMake_TEST_FAILED}\" PARENT_SCOPE) endfunction() set(check_pairs \"${CMAKE_BINARY_DIR}/topcc.c|${CMAKE_BINARY_DIR}/topccdep.txt\" \"$|${CMAKE_BINARY_DIR}/topexedep.txt\" \"$|${CMAKE_BINARY_DIR}/toplibdep.txt\" \"$|${CMAKE_BINARY_DIR}/toplibdep2.txt\" \"${CMAKE_BINARY_DIR}/DepfileSubdir/subcc.c|${CMAKE_BINARY_DIR}/DepfileSubdir/subccdep.txt\" \"$|${CMAKE_BINARY_DIR}/DepfileSubdir/subexedep.txt\" \"$|${CMAKE_BINARY_DIR}/DepfileSubdir/sublibdep.txt\" ) if(check_step EQUAL 3) list(APPEND check_pairs \"${CMAKE_BINARY_DIR}/step3.timestamp|${CMAKE_BINARY_DIR}/topcc.c\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$\" \"${CMAKE_BINARY_DIR}/step3.timestamp|${CMAKE_BINARY_DIR}/DepfileSubdir/subcc.c\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$\" ) endif() ")