summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-03-24 12:49:43 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-03-24 12:49:43 (GMT)
commit917d49ed93b7b43ac3508dbd81f0645433880724 (patch)
tree10b272f195f21e2ee24e92ea37c167daaa63a8c7 /Tests/RunCMake
parent5b2acf6c1c904df96bd0031c9469e61118da5200 (diff)
parentb06e17da7b4137d22ae7cfcf14c6aa3205577822 (diff)
downloadCMake-917d49ed93b7b43ac3508dbd81f0645433880724.zip
CMake-917d49ed93b7b43ac3508dbd81f0645433880724.tar.gz
CMake-917d49ed93b7b43ac3508dbd81f0645433880724.tar.bz2
Merge topic 'cmake-depend-in-project-only'
b06e17da Help: Add notes for topic 'cmake-depend-in-project-only' 52540245 Tests: Add test for CMAKE_DEPENDS_IN_PROJECT_ONLY variable b1e1aa1e Makefile: Optionally scan only source and build trees for dependencies
Diffstat (limited to 'Tests/RunCMake')
-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