diff --git a/ports/boost/portfile.cmake b/ports/boost/portfile.cmake index c15f7c3126..fa264fa512 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 0000000000..28d4290106 --- /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 ...]) + 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 f5823fb949..d4dd18fd53 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 0000000000..084bf390ad --- /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 c770d3f251..eaeba787da 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 0000000000..d43e7112ee --- /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 33861a7ebe..3e62481267 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 0000000000..40e214fde0 --- /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 026c1573ae..7b98fa477d 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 0000000000..3b42b86e4e --- /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 a18a8ceebc..dddaf51c1e 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 0000000000..c0678a8250 --- /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 333dc8ae3e..491d6a8d5e 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 0000000000..fa226ceede --- /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 225b23353e..1d45087b02 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 0000000000..ccd47717f7 --- /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 fe4fb72509..c2067ff9b6 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 0000000000..19203399c6 --- /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 4f83f2eed4..0331e0f77a 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 5f1b39bc78..1a856e17d7 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 0000000000..f535cb6a40 --- /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 c41d61bdae..ec8b05ffca 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 0000000000..39d8618221 --- /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 cc006811bc..f48b04d682 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) {