Skip to content

Commit 7aac2c3

Browse files
committed
fixed removed trailing whitespace from the rebase
Signed-off-by: Klaim (Joël Lamotte) <142265+Klaim@users.noreply.github.com>
1 parent ea07e89 commit 7aac2c3

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/mkdocs/docs/integration/package_managers.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ and follow the then displayed descriptions. Please see the vcpkg project for any
363363
```cmake title="CMakeLists.txt"
364364
--8<-- "integration/vcpkg/CMakeLists.txt"
365365
```
366-
366+
367367
```cpp title="example.cpp"
368368
--8<-- "integration/vcpkg/example.cpp"
369369
```
@@ -408,7 +408,7 @@ installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nl
408408
```cmake title="CMakeLists.txt"
409409
--8<-- "integration/vcpkg/CMakeLists.txt"
410410
```
411-
411+
412412
```cpp title="example.cpp"
413413
--8<-- "integration/vcpkg/example.cpp"
414414
```
@@ -418,7 +418,7 @@ installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nl
418418
```shell
419419
cget init
420420
```
421-
421+
422422
3. Install the library
423423

424424
```shell
@@ -476,15 +476,15 @@ dotnet add package nlohmann.json
476476
Most of the packages in NuGet gallery are .NET packages and would not be useful in a C++ project. Microsoft
477477
recommends adding “native” and “nativepackage” tags to C++ NuGet packages to distinguish them, but even adding
478478
“native” to search query would still show many .NET-only packages in the list.
479-
479+
480480
Nevertheless, after finding the package you want, click on “Install” button and accept confirmation dialogs.
481481
After the package is successfully added to the projects, you should be able to build and execute the project
482482
without the need for making any more changes to build settings.
483483

484484
!!! note
485485

486486
A few notes:
487-
487+
488488
- NuGet packages are installed per project and not system-wide. The header and binaries for the package are only
489489
available to the project it is added to, and not other projects (obviously unless we add the package to those
490490
projects as well)
@@ -502,9 +502,9 @@ dotnet add package nlohmann.json
502502

503503
After you add a NuGet package, three changes occur in the project source directory. Of course, we could make these
504504
changes manually instead of using GUI:
505-
505+
506506
![](nuget/nuget-project-changes.png)
507-
507+
508508
1. A `packages.config` file will be created (or updated to include the package name if one such file already
509509
exists). This file contains a list of the packages required by this project (name and minimum version) and must
510510
be added to the project source code repository, so if you move the source code to a new machine, MSBuild/NuGet
@@ -519,29 +519,29 @@ dotnet add package nlohmann.json
519519

520520
2. A `packages` folder which contains actual files in the packages (these are header and binary files required for
521521
a successful build, plus a few metadata files). In case of this library for example, it contains `json.hpp`:
522-
522+
523523
![](nuget/nuget-package-content.png)
524-
524+
525525
!!! note
526526

527527
This directory should not be added to the project source code repository, as it will be restored before each
528528
build by MSBuild/NuGet. If you go ahead and delete this folder, then build the project again, it will
529529
magically re-appear!
530-
530+
531531
3. Project MSBuild makefile (which for Visual C++ projects has a .vcxproj extension) will be updated to include
532532
settings from the package.
533-
533+
534534
![](nuget/nuget-project-makefile.png)
535-
535+
536536
The important bit for us here is line 170, which tells MSBuild to import settings from
537537
`packages\nlohmann.json.3.5.0\build\native\nlohmann.json.targets` file. This is a file the package creator
538538
created and added to the package (you can see it is one of the two files I created in this repository, the other
539539
just contains package attributes like name and version number). What does it contain?
540-
540+
541541
For our header-only repository, the only setting we need is to add our include directory to the list of
542542
`AdditionalIncludeDirectories`:
543543

544-
```xml
544+
```xml
545545
<?xml version="1.0" encoding="utf-8"?>
546546
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
547547
<ItemDefinitionGroup>
@@ -554,21 +554,21 @@ dotnet add package nlohmann.json
554554

555555
For libraries with binary files, we will need to add `.lib` files to linker inputs and add settings to copy
556556
`.dll` and other redistributable files to output directory, if needed.
557-
557+
558558
There are other changes to the makefile as well:
559-
559+
560560
- Lines 165-167 add the `packages.config` as one of project files (so it is shown in Solution Explorer tree
561561
view). It is added as None (no build action) and removing it wouldn’t affect build.
562-
562+
563563
- Lines 172-177 check to ensure the required packages are present. This will display a build error if package
564564
directory is empty (for example when NuGet cannot restore packages because Internet connection is down).
565565
Again, if you omit this section, the only change in build would be a more cryptic error message if build
566566
fails.
567-
567+
568568
!!! note
569569

570570
Changes to .vcxproj makefile should also be added to project source code repository.
571-
571+
572572
As you can see, the mechanism NuGet uses to modify project settings is through MSBuild makefiles, so using NuGet
573573
with other build systems and compilers (like CMake) as a dependency manager is either impossible or more problematic
574574
than useful.
@@ -645,7 +645,7 @@ If you are using [MSYS2](http://www.msys2.org/), you can use the [mingw-w64-nloh
645645
- :octicons-file-24: File issues at the [MacPorts issue tracker](https://trac.macports.org/newticket?port=nlohmann-json)
646646
- :octicons-question-24: [MacPorts website](https://www.macports.org)
647647

648-
If you are using [MacPorts](https://ports.macports.org), execute
648+
If you are using [MacPorts](https://ports.macports.org), execute
649649

650650
```shell
651651
sudo port install nlohmann-json
@@ -892,7 +892,7 @@ CPMAddPackage("gh:nlohmann/json@3.12.0")
892892
```shell
893893
xmake
894894
```
895-
895+
896896
3. Run
897897

898898
```shell

0 commit comments

Comments
 (0)