diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c new file mode 100644 index 000000000..bcb8745bf --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c @@ -0,0 +1,2 @@ +#include +int main() { return MakeInProjectOnly(); } diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake new file mode 100644 index 000000000..add9aeb69 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake @@ -0,0 +1,16 @@ +enable_language(C) +get_filename_component(include_dir "${CMAKE_BINARY_DIR}" PATH) +include_directories("${include_dir}") +add_executable(MakeInProjectOnly MakeInProjectOnly.c) +set(CMAKE_DEPENDS_IN_PROJECT_ONLY 1) +file(GENERATE OUTPUT check-$>.cmake CONTENT " +if (check_step EQUAL 1) + set(check_pairs + \"$|${include_dir}/MakeInProjectOnly.h\" + ) +else() + set(check_pairs + \"${include_dir}/MakeInProjectOnly.h|\$\" + ) +endif() +") diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake new file mode 100644 index 000000000..d6551abe0 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/../MakeInProjectOnly.h" [[ +int MakeInProjectOnly(void) { return 0; } +]]) diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake new file mode 100644 index 000000000..145605be7 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/../MakeInProjectOnly.h" [[ +int MakeInProjectOnly(void) { return 1; } +]]) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 26ffcc0e8..6b2b85a2b 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -41,6 +41,11 @@ endif() run_BuildDepends(Custom-Always) +if(RunCMake_GENERATOR MATCHES "Make" AND + NOT "${RunCMake_BINARY_DIR}" STREQUAL "${RunCMake_SOURCE_DIR}") + run_BuildDepends(MakeInProjectOnly) +endif() + function(run_ReGeneration) # test re-generation of project even if CMakeLists.txt files disappeared