diff options
author | Kai Wang <wangkai86@huawei.com> | 2020-12-18 06:47:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-05 12:48:27 (GMT) |
commit | b696f7807303b421c3f59ff2bf8229c96f09f1fa (patch) | |
tree | 246f99b964b4cf5b43178adde879025dc01c4c37 /Tests/RunCMake/BuildDepends | |
parent | da2474626b8a02e957021b30453f5afc8d7246b9 (diff) | |
download | CMake-b696f7807303b421c3f59ff2bf8229c96f09f1fa.zip CMake-b696f7807303b421c3f59ff2bf8229c96f09f1fa.tar.gz CMake-b696f7807303b421c3f59ff2bf8229c96f09f1fa.tar.bz2 |
cmDepends: merge dependers of depend makefile
Since one depender has multiple dependees, depend makefile generated
same depender line by line, to reduce file size and refine make file
parse speed, merge same dependers to one. And add a testcase for
large depend.make which generated source file includes 20000 header
files and run build and incremental build
Signed-off-by: Wangkai <wangkai86@huawei.com>
Signed-off-by: Zhaoyingdong <zhaoyingdong@huawei.com>
Diffstat (limited to 'Tests/RunCMake/BuildDepends')
4 files changed, 38 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/MakeDependencies.cmake b/Tests/RunCMake/BuildDepends/MakeDependencies.cmake new file mode 100644 index 0000000..33e8c7e --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeDependencies.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.c) + +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " +set(check_pairs + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\" + \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.h\" + ) +set(check_exes + \"$<TARGET_FILE:main>\" + ) +") diff --git a/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake b/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake new file mode 100644 index 0000000..c74f033 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeDependencies.step1.cmake @@ -0,0 +1,18 @@ +file(TOUCH "${RunCMake_TEST_BINARY_DIR}/main.c") +foreach(i RANGE 1 20000) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/temp_header_file_${i}.h" + "#define HEADER_${i} ${i}\n" + ) + file(APPEND "${RunCMake_TEST_BINARY_DIR}/main.c" + "#include \"temp_header_file_${i}.h\"\n" + ) +endforeach() +file(APPEND "${RunCMake_TEST_BINARY_DIR}/main.c" + "#include \"main.h\"\n" + ) +file(APPEND "${RunCMake_TEST_BINARY_DIR}/main.c" + "int main(void) { return COUNT; }\n" + ) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" + "#define COUNT 1\n" + ) diff --git a/Tests/RunCMake/BuildDepends/MakeDependencies.step2.cmake b/Tests/RunCMake/BuildDepends/MakeDependencies.step2.cmake new file mode 100644 index 0000000..c826d3c --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeDependencies.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" + "#define COUNT 2\n" + ) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 1b7b8d9..67da6ae 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -143,3 +143,7 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") run_BuildDepends(CustomCommandDepfile) set(run_BuildDepends_skip_step_3 1) endif() + +if(RunCMake_GENERATOR MATCHES "Make") + run_BuildDepends(MakeDependencies) +endif() |