aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-11-16 23:54:55 -0800
committerRobert Schumacher <roschuma@microsoft.com>2017-11-16 23:54:55 -0800
commit1b2f75be941e9eed5986c10eb99fd6049490daec (patch)
treec782bfff26daa96f0aba34ec39e74513330e6cc0
parent468e9e70e644eb26258434c9e27e34935eb3e06d (diff)
downloadvcpkg-1b2f75be941e9eed5986c10eb99fd6049490daec.tar.gz
vcpkg-1b2f75be941e9eed5986c10eb99fd6049490daec.zip
[vcpkg] Support \share\<port>\usage to handle libraries which are found through built-in Find Modules.
-rw-r--r--ports/boost/portfile.cmake2
-rw-r--r--ports/boost/usage5
-rw-r--r--ports/bzip2/portfile.cmake2
-rw-r--r--ports/bzip2/usage4
-rw-r--r--ports/curl/portfile.cmake2
-rw-r--r--ports/curl/usage5
-rw-r--r--ports/freeglut/portfile.cmake3
-rw-r--r--ports/freeglut/usage4
-rw-r--r--ports/freetype/portfile.cmake1
-rw-r--r--ports/freetype/usage5
-rw-r--r--ports/glew/portfile.cmake3
-rw-r--r--ports/glew/usage4
-rw-r--r--ports/gtest/portfile.cmake2
-rw-r--r--ports/gtest/usage6
-rw-r--r--ports/libjpeg-turbo/portfile.cmake1
-rw-r--r--ports/libjpeg-turbo/usage5
-rw-r--r--ports/libpng/portfile.cmake2
-rw-r--r--ports/libpng/usage4
-rw-r--r--ports/openssl/portfile-uwp.cmake2
-rw-r--r--ports/openssl/portfile.cmake2
-rw-r--r--ports/openssl/usage4
-rw-r--r--ports/zlib/portfile.cmake4
-rw-r--r--ports/zlib/usage4
-rw-r--r--toolsrc/src/vcpkg/install.cpp21
24 files changed, 89 insertions, 8 deletions
diff --git a/ports/boost/portfile.cmake b/ports/boost/portfile.cmake
index c15f7c312..fa264fa51 100644
--- a/ports/boost/portfile.cmake
+++ b/ports/boost/portfile.cmake
@@ -342,3 +342,5 @@ move_to_manual_link(boost_test_exec_monitor)
move_to_manual_link(boost_prg_exec_monitor)
vcpkg_copy_pdbs()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/boost/usage b/ports/boost/usage
new file mode 100644
index 000000000..28d429010
--- /dev/null
+++ b/ports/boost/usage
@@ -0,0 +1,5 @@
+The package boost is compatible with built-in CMake targets:
+
+ find_package(Boost REQUIRED [COMPONENTS <libs>...])
+ target_link_libraries(main PRIVATE ${Boost_LIBRARIES})
+ target_include_directories(main PRIVATE ${Boost_INCLUDE_DIRS})
diff --git a/ports/bzip2/portfile.cmake b/ports/bzip2/portfile.cmake
index f5823fb94..d4dd18fd5 100644
--- a/ports/bzip2/portfile.cmake
+++ b/ports/bzip2/portfile.cmake
@@ -36,3 +36,5 @@ file(WRITE ${CURRENT_PACKAGES_DIR}/include/bzlib.h "${BZLIB_H}")
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bzip2)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/bzip2/LICENSE ${CURRENT_PACKAGES_DIR}/share/bzip2/copyright)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/bzip2/usage b/ports/bzip2/usage
new file mode 100644
index 000000000..084bf390a
--- /dev/null
+++ b/ports/bzip2/usage
@@ -0,0 +1,4 @@
+The package bzip2 is compatible with built-in CMake targets:
+
+ find_package(BZip2 REQUIRED)
+ target_link_libraries(main PRIVATE BZip2::BZip2)
diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake
index c770d3f25..eaeba787d 100644
--- a/ports/curl/portfile.cmake
+++ b/ports/curl/portfile.cmake
@@ -73,3 +73,5 @@ endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/include/curl/curl.h "${CURL_H}")
vcpkg_copy_pdbs()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/curl/usage b/ports/curl/usage
new file mode 100644
index 000000000..d43e7112e
--- /dev/null
+++ b/ports/curl/usage
@@ -0,0 +1,5 @@
+The package curl is compatible with built-in CMake targets:
+
+ find_package(CURL REQUIRED)
+ target_link_libraries(main PRIVATE ${CURL_LIBRARIES})
+ target_include_directories(main PRIVATE ${CURL_INCLUDE_DIRS})
diff --git a/ports/freeglut/portfile.cmake b/ports/freeglut/portfile.cmake
index 33861a7eb..3e6248126 100644
--- a/ports/freeglut/portfile.cmake
+++ b/ports/freeglut/portfile.cmake
@@ -53,4 +53,5 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/freeglut)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/freeglut/COPYING ${CURRENT_PACKAGES_DIR}/share/freeglut/copyright)
-vcpkg_copy_pdbs() \ No newline at end of file
+vcpkg_copy_pdbs()
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/freeglut/usage b/ports/freeglut/usage
new file mode 100644
index 000000000..40e214fde
--- /dev/null
+++ b/ports/freeglut/usage
@@ -0,0 +1,4 @@
+The package freeglut is compatible with built-in CMake targets:
+
+ find_package(GLUT REQUIRED)
+ target_link_libraries(main PRIVATE GLUT::GLUT)
diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake
index 026c1573a..7b98fa477 100644
--- a/ports/freetype/portfile.cmake
+++ b/ports/freetype/portfile.cmake
@@ -58,3 +58,4 @@ file(COPY
file(RENAME ${CURRENT_PACKAGES_DIR}/share/freetype/LICENSE.TXT ${CURRENT_PACKAGES_DIR}/share/freetype/copyright)
vcpkg_copy_pdbs()
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/freetype/usage b/ports/freetype/usage
new file mode 100644
index 000000000..3b42b86e4
--- /dev/null
+++ b/ports/freetype/usage
@@ -0,0 +1,5 @@
+The package freetype is compatible with built-in CMake targets:
+
+ find_package(Freetype REQUIRED)
+ target_link_libraries(main PRIVATE ${FREETYPE_LIBRARIES})
+ target_include_directories(main PRIVATE ${FREETYPE_INCLUDE_DIRS})
diff --git a/ports/glew/portfile.cmake b/ports/glew/portfile.cmake
index a18a8ceeb..dddaf51c1 100644
--- a/ports/glew/portfile.cmake
+++ b/ports/glew/portfile.cmake
@@ -48,4 +48,5 @@ vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
-file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glew RENAME copyright) \ No newline at end of file
+file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/glew RENAME copyright)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/glew/usage b/ports/glew/usage
new file mode 100644
index 000000000..c0678a825
--- /dev/null
+++ b/ports/glew/usage
@@ -0,0 +1,4 @@
+The package glew is compatible with built-in CMake targets:
+
+ find_package(GLEW REQUIRED)
+ target_link_libraries(main PRIVATE GLEW::GLEW)
diff --git a/ports/gtest/portfile.cmake b/ports/gtest/portfile.cmake
index 333dc8ae3..491d6a8d5 100644
--- a/ports/gtest/portfile.cmake
+++ b/ports/gtest/portfile.cmake
@@ -60,3 +60,5 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock.lib ${CURRENT_PACKAGES_DIR}/
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gmock_main.lib ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link/gmock_main.lib)
vcpkg_copy_pdbs()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/gtest/usage b/ports/gtest/usage
new file mode 100644
index 000000000..fa226ceed
--- /dev/null
+++ b/ports/gtest/usage
@@ -0,0 +1,6 @@
+The package gtest is compatible with built-in CMake targets:
+
+ enable_testing()
+ find_package(GTest REQUIRED)
+ target_link_libraries(main PRIVATE GTest::GTest GTest::Main)
+ add_test(AllTestsInMain main)
diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake
index 225b23353..1d45087b0 100644
--- a/ports/libjpeg-turbo/portfile.cmake
+++ b/ports/libjpeg-turbo/portfile.cmake
@@ -53,3 +53,4 @@ file(COPY
)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/copyright)
vcpkg_copy_pdbs()
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/libjpeg-turbo/usage b/ports/libjpeg-turbo/usage
new file mode 100644
index 000000000..ccd47717f
--- /dev/null
+++ b/ports/libjpeg-turbo/usage
@@ -0,0 +1,5 @@
+The package libjpeg-turbo is compatible with built-in CMake targets:
+
+ find_package(JPEG REQUIRED)
+ target_link_libraries(main PRIVATE ${JPEG_LIBRARIES})
+ target_include_directories(main PRIVATE ${JPEG_INCLUDE_DIR})
diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake
index fe4fb7250..c2067ff9b 100644
--- a/ports/libpng/portfile.cmake
+++ b/ports/libpng/portfile.cmake
@@ -57,3 +57,5 @@ file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpn
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpng/LICENSE ${CURRENT_PACKAGES_DIR}/share/libpng/copyright)
vcpkg_copy_pdbs()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/libpng/usage b/ports/libpng/usage
new file mode 100644
index 000000000..19203399c
--- /dev/null
+++ b/ports/libpng/usage
@@ -0,0 +1,4 @@
+The package libpng is compatible with built-in CMake targets:
+
+ find_package(PNG REQUIRED)
+ target_link_libraries(main PRIVATE PNG::PNG)
diff --git a/ports/openssl/portfile-uwp.cmake b/ports/openssl/portfile-uwp.cmake
index 4f83f2eed..0331e0f77 100644
--- a/ports/openssl/portfile-uwp.cmake
+++ b/ports/openssl/portfile-uwp.cmake
@@ -90,3 +90,5 @@ file(INSTALL
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake
index 5f1b39bc7..1a856e17d 100644
--- a/ports/openssl/portfile.cmake
+++ b/ports/openssl/portfile.cmake
@@ -145,3 +145,5 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
endif()
vcpkg_copy_pdbs()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/openssl/usage b/ports/openssl/usage
new file mode 100644
index 000000000..f535cb6a4
--- /dev/null
+++ b/ports/openssl/usage
@@ -0,0 +1,4 @@
+The package openssl is compatible with built-in CMake targets:
+
+ find_package(OpenSSL REQUIRED)
+ target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake
index c41d61bda..ec8b05ffc 100644
--- a/ports/zlib/portfile.cmake
+++ b/ports/zlib/portfile.cmake
@@ -33,4 +33,6 @@ endif()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright)
-vcpkg_copy_pdbs() \ No newline at end of file
+vcpkg_copy_pdbs()
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/zlib/usage b/ports/zlib/usage
new file mode 100644
index 000000000..39d861822
--- /dev/null
+++ b/ports/zlib/usage
@@ -0,0 +1,4 @@
+The package zlib is compatible with built-in CMake targets:
+
+ find_package(ZLIB REQUIRED)
+ target_link_libraries(main PRIVATE ZLIB::ZLIB)
diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp
index cc006811b..f48b04d68 100644
--- a/toolsrc/src/vcpkg/install.cpp
+++ b/toolsrc/src/vcpkg/install.cpp
@@ -565,6 +565,17 @@ namespace vcpkg::Install
auto& fs = paths.get_filesystem();
+ auto usage_file = paths.installed / bpgh.spec.triplet().canonical_name() / "share" / bpgh.spec.name() / "usage";
+ if (fs.exists(usage_file))
+ {
+ auto maybe_contents = fs.read_contents(usage_file);
+ if (auto p_contents = maybe_contents.get())
+ {
+ System::println(*p_contents);
+ }
+ return;
+ }
+
auto files = fs.read_lines(paths.listfile_path(bpgh));
if (auto p_lines = files.get())
{
@@ -595,10 +606,10 @@ namespace vcpkg::Install
}
else if (library_targets.size() <= 4)
{
- System::println("\nThe package %s provides CMake targets:\n"
+ System::println("The package %s provides CMake targets:\n"
"\n"
" find_package(%s REQUIRED)\n"
- " target_link_libraries(main PRIVATE %s)",
+ " target_link_libraries(main PRIVATE %s)\n",
bpgh.spec,
path.parent_path().filename().u8string(),
Strings::join(" ", library_targets));
@@ -607,11 +618,11 @@ namespace vcpkg::Install
{
auto omitted = library_targets.size() - 4;
library_targets.erase(library_targets.begin() + 4, library_targets.end());
- System::println("\nThe package %s provides CMake targets:\n"
+ System::println("The package %s provides CMake targets:\n"
"\n"
" find_package(%s REQUIRED)\n"
" # Note: %d targets were omitted\n"
- " target_link_libraries(main PRIVATE %s)",
+ " target_link_libraries(main PRIVATE %s)\n",
bpgh.spec,
path.parent_path().filename().u8string(),
omitted,
@@ -712,7 +723,7 @@ namespace vcpkg::Install
const InstallSummary summary = perform(action_plan, keep_going, paths, status_db);
- System::println("\nTotal elapsed time: %s", summary.total_elapsed_time);
+ System::println("\nTotal elapsed time: %s\n", summary.total_elapsed_time);
if (keep_going == KeepGoing::YES)
{