diff options
author | Brad King <brad.king@kitware.com> | 2019-05-31 17:18:21 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-31 17:18:31 (GMT) |
commit | 187928875d215df8757b291ad629a36df75da42b (patch) | |
tree | 320f5369e8d6d9c3b7eed592c079e6c6f849e99c /Tests | |
parent | 66bba23a4b4c6e7901524677f245d02a31b3eff8 (diff) | |
parent | 42e14d90b1b38df6c698ef230ab06ae9504436d5 (diff) | |
download | CMake-187928875d215df8757b291ad629a36df75da42b.zip CMake-187928875d215df8757b291ad629a36df75da42b.tar.gz CMake-187928875d215df8757b291ad629a36df75da42b.tar.bz2 |
Merge topic 'vs-add-package-reference'
42e14d90b1 VS: Added support for VS package references for nuget
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Leonid Pospelov <pospelovlm@yandex.ru>
Merge-request: !3389
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake | 39 | ||||
-rw-r--r-- | Tests/RunCMake/VS10Project/VsPackageReferences.cmake | 4 |
3 files changed, 44 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 9a0b7a9..55ca9ea 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -21,6 +21,7 @@ run_cmake(VSCSharpDefines) run_cmake(VsSdkDirectories) run_cmake(VsGlobals) run_cmake(VsProjectImport) +run_cmake(VsPackageReferences) if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05) run_cmake(VsJustMyCode) diff --git a/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake b/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake new file mode 100644 index 0000000..4ff5327 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsPackageReferences-check.cmake @@ -0,0 +1,39 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file foo.vcxproj does not exist.") + return() +endif() + + +set(test1Library "boost") +set(test1Version "1.7.0") + + +set(test2Library "SFML") +set(test2Version "2.2.0") + +set(Library1Found FALSE) +set(Library2Found FALSE) + +file(STRINGS "${vcProjectFile}" lines) + +foreach(i 1 2) + set(testLibrary "${test${i}Library}") + set(testVersion "${test${i}Version}") + foreach(line IN LISTS lines) + if(line MATCHES "^ *<PackageReference Include=\"${testLibrary}\".*>$") + if(line MATCHES "^ *<PackageReference .* Version=\"${testVersion}\".*>$") + set(Library${i}Found TRUE) + message(STATUS "foo.vcxproj is using package reference ${testLibrary} with version ${testVersion}") + elseif() + message(STATUS "foo.vcxproj failed to define reference ${testLibrary} with version ${testVersion}") + set(Library${i}Found FALSE) + endif() + endif() + endforeach() +endforeach() + +if(NOT Library1Found OR NOT Library2Found) + set(RunCMake_TEST_FAILED "Failed to find package references") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsPackageReferences.cmake b/Tests/RunCMake/VS10Project/VsPackageReferences.cmake new file mode 100644 index 0000000..224ab18 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsPackageReferences.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_property(TARGET foo PROPERTY VS_PACKAGE_REFERENCES "boost_1.7.0;SFML_2.2.0") |