mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 20:24:35 +03:00
fix toc and headers #3
This commit is contained in:
@@ -1,14 +1,10 @@
|
|||||||
= Static Library
|
= Static Library
|
||||||
|
|
||||||
:toc:
|
:toc:
|
||||||
:toc-placement!:
|
:toc-placement!:
|
||||||
|
|
||||||
toc::[]
|
toc::[]
|
||||||
|
|
||||||
|
# Introduction
|
||||||
[[intro]]
|
|
||||||
Introduction
|
|
||||||
------------
|
|
||||||
|
|
||||||
Shows a hello world example which first creates and links a static library
|
Shows a hello world example which first creates and links a static library
|
||||||
|
|
||||||
@@ -30,13 +26,10 @@ $ tree
|
|||||||
* src/Hello.cpp - A source file to compile
|
* src/Hello.cpp - A source file to compile
|
||||||
* src/main.cpp - The source file with main
|
* src/main.cpp - The source file with main
|
||||||
|
|
||||||
[[concepts]]
|
|
||||||
Concepts
|
|
||||||
~~~~~~~~
|
|
||||||
|
|
||||||
[[adding-static-library]]
|
# Concepts
|
||||||
Adding a Static Library
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
## Adding a Static Library
|
||||||
|
|
||||||
The +add_library()+ function is used to create a library from some source files.
|
The +add_library()+ function is used to create a library from some source files.
|
||||||
This is called as follows:
|
This is called as follows:
|
||||||
@@ -53,9 +46,7 @@ add_library(hello_library STATIC ${library_SOURCES})
|
|||||||
This will be used to create a static library with the name libhello_library.a with
|
This will be used to create a static library with the name libhello_library.a with
|
||||||
the sources from the +library_SOURCES+ variable.
|
the sources from the +library_SOURCES+ variable.
|
||||||
|
|
||||||
[[linking-library]]
|
## Linking a Library
|
||||||
Linking a Library
|
|
||||||
^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
When creating an executable that will use your library you must tell the compiler
|
When creating an executable that will use your library you must tell the compiler
|
||||||
about the library. This can be done using the +target_link_library()+ function.
|
about the library. This can be done using the +target_link_library()+ function.
|
||||||
@@ -79,9 +70,7 @@ An example of this being called by the compiler is
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[[building-the-example]]
|
# Building the Example
|
||||||
Building the Example
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
|
|||||||
Reference in New Issue
Block a user