Merge branch 'master' into IrvingW-patch-1

This commit is contained in:
Thom Troy 2021-09-14 20:20:45 +01:00 committed by GitHub
commit 8ad0adae36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 10 deletions

View File

@ -170,8 +170,6 @@ A-hello-cmake$ mkdir build
A-hello-cmake$ cd build/
A-hello-cmake/build$ make ..
make: Nothing to be done for `..'.
matrim@freyr:~/workspace/cmake-examples/01-basic/A-hello-cmake/build$ cmake ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4

View File

@ -176,7 +176,7 @@ Extra Notes
Overriding the default install location
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
As mentioned the default install location is set from the +CMAKE_INSTALL_PERFIX+,
As mentioned the default install location is set from the +CMAKE_INSTALL_PREFIX+,
which defaults to `/usr/local/`
If you want to change this default location for all users you can add the

View File

@ -51,7 +51,7 @@ The arguments are:
* Boost - Name of the library. This is part of used to find the module file FindBoost.cmake
* 1.46.1 - The minimum version of boost to find
* REQUIRED - Tells the module that this is required and to fail it it cannot be found
* REQUIRED - Tells the module that this is required and to fail if it cannot be found
* COMPONENTS - The list of components to find in the library.
Boost includes can take more arguments and also make use of other variables.

View File

@ -78,7 +78,7 @@ add_subdirectory(subbinary)
When a project is created using the `project()` command, CMake will automatically
create a number of variables which can be used to reference details about the project.
These variables can then be used by other sub-projects or the main project. For exampe,
These variables can then be used by other sub-projects or the main project. For example,
to reference the source directory for a different project you can use.
[source,cmake]
@ -137,7 +137,7 @@ target_include_directories(${PROJECT_NAME}
## Referencing Libraries from Sub-Projects
If a sub-project creates a library, it can be referenced by other projects by
calling the name of the project in the `target_link_libraries()` command. This
calling the name of the target in the `target_link_libraries()` command. This
means that you don't have to reference the full path of the new library and it
is added as a dependency.
@ -176,8 +176,8 @@ binary using them.
This is controlled by the scope in the `target_include_directories()` command when creating
the libraries. In this example because the subbinary executable links the sublibrary1
and sublibrary2 libraries it will automatically include the `${sublibrary1_SOURCE_DIR}/inc`
and `${sublibrary2_SOURCE_DIR}/inc` folders as they are exported with the
and sublibrary2 libraries it will automatically include the `${sublibrary1_SOURCE_DIR}/include`
and `${sublibrary2_SOURCE_DIR}/include` folders as they are exported with the
+PUBLIC+ and +INTERFACE+ scopes of the libraries.
# Building the example

View File

@ -3,8 +3,8 @@ project(subbinary)
# Create the executable
add_executable(${PROJECT_NAME} main.cpp)
# Link the static library from subproject1 using it's alias sub::lib1
# Link the header only library from subproject2 using it's alias sub::lib2
# Link the static library from subproject1 using its alias sub::lib1
# Link the header only library from subproject2 using its alias sub::lib2
# This will cause the include directories for that target to be added to this project
target_link_libraries(${PROJECT_NAME}
sub::lib1