mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 20:24:35 +03:00
Update toc and headings #3
This commit is contained in:
@@ -1,13 +1,10 @@
|
|||||||
= Basic Sub-Project
|
= Basic Sub-Project
|
||||||
|
|
||||||
:toc:
|
:toc:
|
||||||
:toc-placement!:
|
:toc-placement!:
|
||||||
|
|
||||||
toc::[]
|
toc::[]
|
||||||
|
|
||||||
[[intro]]
|
# Introduction
|
||||||
Introduction
|
|
||||||
------------
|
|
||||||
|
|
||||||
This example shows how to setup a CMake project that includes sub-projects. The
|
This example shows how to setup a CMake project that includes sub-projects. The
|
||||||
top level CMakeLists.txt calls the CMakeLists.txt in the sub directories to
|
top level CMakeLists.txt calls the CMakeLists.txt in the sub directories to
|
||||||
@@ -46,13 +43,9 @@ The files included in this example are:
|
|||||||
* sublibrary2/CMakeLists.txt - to setup header only library
|
* sublibrary2/CMakeLists.txt - to setup header only library
|
||||||
* sublibrary2/inc/sublib2.h
|
* sublibrary2/inc/sublib2.h
|
||||||
|
|
||||||
[[concepts]]
|
# Concepts
|
||||||
Concepts
|
|
||||||
~~~~~~~~
|
|
||||||
|
|
||||||
[[add-sub-dir]]
|
## Adding a Sub-Directory
|
||||||
Adding a Sub-Directory
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
A CMakeLists.txt file can include and call sub-directories which include a CMakeLists.txt
|
A CMakeLists.txt file can include and call sub-directories which include a CMakeLists.txt
|
||||||
files.
|
files.
|
||||||
@@ -64,9 +57,7 @@ add_subdirectory(sublibrary2)
|
|||||||
add_subdirectory(subbinary)
|
add_subdirectory(subbinary)
|
||||||
----
|
----
|
||||||
|
|
||||||
[[referencing-sub-project-directories]]
|
## Referencing Sub-Project Directories
|
||||||
Referencing Sub-Project Directories
|
|
||||||
+++++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
When a project is created using the `project()` command, CMake will automatically
|
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.
|
create a number of variables which can be used to reference details about the project.
|
||||||
@@ -106,11 +97,7 @@ In this example the binary directories created would be `sublibrary1_BINARY_DIR`
|
|||||||
|=======================================================================
|
|=======================================================================
|
||||||
|
|
||||||
|
|
||||||
|
## Referencing Libraries from Sub-Projects
|
||||||
|
|
||||||
[[referencing-libraries-from-sub-projects]]
|
|
||||||
Referencing Libraries from Sub-Projects
|
|
||||||
+++++++++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
If a sub-project creates a library, it can be referenced by other projects by
|
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 project in the `target_link_libraries()` command. This
|
||||||
@@ -124,9 +111,7 @@ target_link_libraries(subbinary
|
|||||||
)
|
)
|
||||||
----
|
----
|
||||||
|
|
||||||
[[building-the-example]]
|
# Building the example
|
||||||
Building the example
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
|
|||||||
Reference in New Issue
Block a user