summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-03-22 20:03:28 (GMT)
committerBrad King <brad.king@kitware.com>2016-03-23 18:03:01 (GMT)
commit525402450a1ccde0e9187c9613752f728a96149b (patch)
tree5e93ef47805a0a3765bd4f19a7b2f7ad1f340e1f /Tests
parentb1e1aa1e6a2aa4c0da9d39f2e9f2a80d093f1dc7 (diff)
downloadCMake-525402450a1ccde0e9187c9613752f728a96149b.zip
CMake-525402450a1ccde0e9187c9613752f728a96149b.tar.gz
CMake-525402450a1ccde0e9187c9613752f728a96149b.tar.bz2
Tests: Add test for CMAKE_DEPENDS_IN_PROJECT_ONLY variable
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/BuildDepends/MakeInProjectOnly.c2
-rw-r--r--Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake16
-rw-r--r--Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/MakeInProjectOnly.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake5
5 files changed, 29 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c
new file mode 100644
index 0000000..bcb8745
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.c
@@ -0,0 +1,2 @@
+#include <MakeInProjectOnly.h>
+int main() { return MakeInProjectOnly(); }
diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.cmake
new file mode 100644
index 0000000..add9aeb
--- /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-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
+if (check_step EQUAL 1)
+ set(check_pairs
+ \"$<TARGET_FILE:MakeInProjectOnly>|${include_dir}/MakeInProjectOnly.h\"
+ )
+else()
+ set(check_pairs
+ \"${include_dir}/MakeInProjectOnly.h|\$<TARGET_FILE:MakeInProjectOnly>\"
+ )
+endif()
+")
diff --git a/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake b/Tests/RunCMake/BuildDepends/MakeInProjectOnly.step1.cmake
new file mode 100644
index 0000000..d6551ab
--- /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 0000000..145605b
--- /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 26ffcc0..6b2b85a 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