summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorLeonid Pospelov <pospelovlm@yandex.ru>2019-03-24 01:47:53 (GMT)
committerBrad King <brad.king@kitware.com>2019-04-15 17:05:07 (GMT)
commitd145d72e708b7d742fb1324c056ba2c0254dda76 (patch)
tree005ebcd91ddd9ab8fff3198ec64e8b1a3e50f253 /Tests/RunCMake
parent4bbd315097fb7161ab245ff0959472729cea2793 (diff)
downloadCMake-d145d72e708b7d742fb1324c056ba2c0254dda76.zip
CMake-d145d72e708b7d742fb1324c056ba2c0254dda76.tar.gz
CMake-d145d72e708b7d742fb1324c056ba2c0254dda76.tar.bz2
VS: add target property VS_PROJECT_IMPORT_<propspath>
Fixes: #18998
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/VsProjectImport-check.cmake28
-rw-r--r--Tests/RunCMake/VS10Project/VsProjectImport.cmake11
3 files changed, 40 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index df253a9..219e529 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -18,3 +18,4 @@ run_cmake(VsCSharpDeployFiles)
run_cmake(VSCSharpDefines)
run_cmake(VsSdkDirectories)
run_cmake(VsGlobals)
+run_cmake(VsProjectImport)
diff --git a/Tests/RunCMake/VS10Project/VsProjectImport-check.cmake b/Tests/RunCMake/VS10Project/VsProjectImport-check.cmake
new file mode 100644
index 0000000..e438bf4
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsProjectImport-check.cmake
@@ -0,0 +1,28 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(test1Import "path\\\\to\\\\nuget_packages\\\\Foo.1.0.0\\\\build\\\\Foo.props")
+set(test2Import "path\\\\to\\\\nuget_packages\\\\Bar.1.0.0\\\\build\\\\Bar.props")
+
+set(import1Found FALSE)
+set(import2Found FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+
+foreach(i 1 2)
+ set(testImport "${test${i}Import}")
+ foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<Import Project=\".*${test1Import}\" />$")
+ message(STATUS "foo.vcxproj is using project import ${testImport}")
+ set(import${i}Found TRUE)
+ endif()
+ endforeach()
+endforeach()
+
+if(NOT import1Found OR NOT import2Found)
+ set(RunCMake_TEST_FAILED "Imported project not found.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsProjectImport.cmake b/Tests/RunCMake/VS10Project/VsProjectImport.cmake
new file mode 100644
index 0000000..70bdded
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsProjectImport.cmake
@@ -0,0 +1,11 @@
+enable_language(CXX)
+add_library(foo foo.cpp)
+
+set(test1Import "path/to/nuget_packages/Foo.1.0.0/build/Foo.props")
+set(test2Import "path/to/nuget_packages/Bar.1.0.0/build/Bar.props")
+
+set_property(TARGET foo PROPERTY
+ VS_PROJECT_IMPORT
+ ${test1Import}
+ ${test2Import}
+ )