-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
# Code reuse with functions and macros | ||
|
||
Code reuse with functions and macros | ||
This recipe will show how to use [functions] and [macros] in CMake and discuss | ||
the differences between the two. | ||
|
||
[functions]: https://cmake.org/cmake/help/latest/command/function.html#command:function | ||
[macros]: https://cmake.org/cmake/help/latest/command/macro.html#command:macro | ||
|
||
|
||
- [cxx-example](cxx-example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This recipe will show how to use [functions] and [macros] in CMake and discuss | ||
the differences between the two. | ||
|
||
[functions]: https://cmake.org/cmake/help/latest/command/function.html#command:function | ||
[macros]: https://cmake.org/cmake/help/latest/command/macro.html#command:macro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Splitting CMake sources into modules | ||
|
||
Abstract to be written ... | ||
We will show how to separate custom CMake code into our own [modules], rather | ||
than keeping everything in a central `CMakeLists.txt`. | ||
|
||
[modules]: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#modules | ||
|
||
|
||
- [example](example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
We will show how to separate custom CMake code into our own [modules], rather | ||
than keeping everything in a central `CMakeLists.txt`. | ||
|
||
[modules]: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Writing a function to test and set compiler flags | ||
|
||
Abstract to be written ... | ||
Elaborating on [Recipe 7 in Chapter 5](../../chapter-05/recipe-07), we will show | ||
how to write a function to test and set compiler flags for your project. | ||
|
||
|
||
- [c-cxx-example](c-cxx-example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Elaborating on [Recipe 7 in Chapter 5](../../chapter-05/recipe-07), we will show | ||
how to write a function to test and set compiler flags for your project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Defining a function or macro with named arguments | ||
|
||
Abstract to be written ... | ||
We will show how to enhance the example in [Recipe 1, _Code reuse with functions and macros_](../recipe-01) | ||
by letting the function accept _named arguments_. We will use the built-in [`cmake_parse_arguments`] command. | ||
|
||
[`cmake_parse_arguments`]: https://cmake.org/cmake/help/latest/command/cmake_parse_arguments.html | ||
|
||
|
||
- [cxx-example](cxx-example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
We will show how to enhance the example in [Recipe 1, _Code reuse with functions and macros_](../recipe-01) | ||
by letting the function accept _named arguments_. We will use the built-in [`cmake_parse_arguments`] command. | ||
|
||
[`cmake_parse_arguments`]: https://cmake.org/cmake/help/latest/command/cmake_parse_arguments.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# Redefining functions and macros | ||
|
||
Abstract to be written ... | ||
This recipe shows how to redefine functions and macros. Our example will show | ||
how to emulate the [`include_guard`] command, which is built-in since CMake | ||
3.10, on systems running an older version of CMake. | ||
|
||
[`include_guard`]: https://cmake.org/cmake/help/latest/command/include_guard.html | ||
|
||
|
||
- [example](example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This recipe shows how to redefine functions and macros. Our example will show | ||
how to emulate the [`include_guard`] command, which is built-in since CMake | ||
3.10, on systems running an older version of CMake. | ||
|
||
[`include_guard`]: https://cmake.org/cmake/help/latest/command/include_guard.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Deprecating functions, macros, and variables | ||
|
||
Abstract to be written ... | ||
We will show how to deprecate CMake functions, macros, and variables. This can | ||
be quite helpful when modernizing your CMake-based build system. | ||
|
||
|
||
- [example](example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
We will show how to deprecate CMake functions, macros, and variables. This can | ||
be quite helpful when modernizing your CMake-based build system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# Limiting scope with `add_subdirectory` | ||
|
||
Abstract to be written ... | ||
This recipe discusses how to organize the CMake build system for large code | ||
projects. We will show how to use [`add_subdirectory`] to limit the scope of | ||
variables, lower CMake code complexity, and simplify maintenance. | ||
|
||
[`add_subdirectory`]: https://cmake.org/cmake/help/latest/command/add_subdirectory.html | ||
|
||
|
||
- [cxx-example](cxx-example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This recipe discusses how to organize the CMake build system for large code | ||
projects. We will show how to use [`add_subdirectory`] to limit the scope of | ||
variables, lower CMake code complexity, and simplify maintenance. | ||
|
||
[`add_subdirectory`]: https://cmake.org/cmake/help/latest/command/add_subdirectory.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
# Avoiding global variables using `target_sources` | ||
|
||
Abstract to be written ... | ||
This recipe discusses an alternative way to organize the CMake build system for large code | ||
projects. We will show how to use [`target_sources`] and [`include`] to limit the scope of | ||
variables, lower CMake code complexity, and simplify maintenance. | ||
We will compare this approach with the one taken in [Recipe 7](../recipe-07) | ||
|
||
[`target_sources`]: https://cmake.org/cmake/help/latest/command/target_sources.html | ||
[`include`]: https://cmake.org/cmake/help/latest/command/include.html | ||
|
||
|
||
- [cxx-example](cxx-example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This recipe discusses an alternative way to organize the CMake build system for large code | ||
projects. We will show how to use [`target_sources`] and [`include`] to limit the scope of | ||
variables, lower CMake code complexity, and simplify maintenance. | ||
We will compare this approach with the one taken in [Recipe 7](../recipe-07) | ||
|
||
[`target_sources`]: https://cmake.org/cmake/help/latest/command/target_sources.html | ||
[`include`]: https://cmake.org/cmake/help/latest/command/include.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Organizing Fortran projects | ||
|
||
Abstract to be written ... | ||
The example in this recipe shows how to use CMake to organize the build system | ||
for a Fortran project. | ||
|
||
|
||
- [fortran-example](fortran-example/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The example in this recipe shows how to use CMake to organize the build system | ||
for a Fortran project. |