From 9c21ef73a553acba25020cfb28b94da8589a74cb Mon Sep 17 00:00:00 2001 From: Radovan Bast Date: Sat, 26 May 2018 23:04:16 +0200 Subject: [PATCH] swap chapters 7 and 8 --- README.md | 42 +++++++++---------- chapter-07/README.md | 17 ++++---- chapter-07/recipe-01/README.md | 2 +- .../recipe-01/cxx-example/CMakeLists.txt | 26 +++++------- .../recipe-01/cxx-example/menu.yml | 0 .../recipe-01/cxx-example/src/CMakeLists.txt | 7 ++-- .../recipe-01/cxx-example/src/main.cpp | 0 .../cxx-example/src/sum_integers.cpp | 0 .../cxx-example/src/sum_integers.hpp | 0 .../cxx-example/tests/CMakeLists.txt | 0 .../recipe-01/cxx-example/tests/catch.hpp | 0 .../recipe-01/cxx-example/tests/test.cpp | 0 chapter-07/recipe-01/title.txt | 2 +- chapter-07/recipe-02/README.md | 4 +- .../recipe-02/example/CMakeLists.txt | 0 .../recipe-02/example/cmake/colors.cmake | 0 chapter-07/recipe-02/title.txt | 2 +- chapter-07/recipe-03/README.md | 4 +- .../recipe-03/example/CMakeLists.txt | 0 .../recipe-03/example/set_compiler_flag.cmake | 0 chapter-07/recipe-03/title.txt | 2 +- chapter-07/recipe-04/README.md | 3 +- .../recipe-04/cxx-example/CMakeLists.txt | 36 +++++++--------- .../recipe-04/cxx-example/cmake/testing.cmake | 0 chapter-07/recipe-04/cxx-example/menu.yml | 7 +--- .../recipe-04/cxx-example/src/CMakeLists.txt | 19 +++------ .../recipe-04/cxx-example/src/main.cpp | 0 .../cxx-example/src/sum_integers.cpp | 0 .../cxx-example/src/sum_integers.hpp | 0 .../cxx-example/tests/CMakeLists.txt | 0 .../recipe-04/cxx-example/tests/catch.hpp | 0 .../recipe-04/cxx-example/tests/test.cpp | 0 chapter-07/recipe-04/title.txt | 2 +- chapter-07/recipe-05/README.md | 4 +- .../recipe-05/example/CMakeLists.txt | 0 .../recipe-05/example/cmake/custom.cmake | 0 .../example/cmake/include_guard.cmake | 0 chapter-07/recipe-05/title.txt | 2 +- chapter-07/recipe-06/README.md | 4 +- .../recipe-06/example/CMakeLists.txt | 0 .../recipe-06/example/cmake/custom.cmake | 0 chapter-07/recipe-06/title.txt | 2 +- .../recipe-07/README.md | 0 .../recipe-07/cxx-example/CMakeLists.txt | 0 .../cxx-example/external/CMakeLists.txt | 0 .../recipe-07/cxx-example/external/README.md | 0 .../cxx-example/external/conversion.cpp | 0 .../cxx-example/external/conversion.hpp | 0 .../recipe-07/cxx-example/menu.yml | 0 .../recipe-07/cxx-example/src/CMakeLists.txt | 0 .../cxx-example/src/evolution/CMakeLists.txt | 0 .../cxx-example/src/evolution/evolution.cpp | 0 .../cxx-example/src/evolution/evolution.hpp | 0 .../cxx-example/src/initial/CMakeLists.txt | 0 .../cxx-example/src/initial/initial.cpp | 0 .../cxx-example/src/initial/initial.hpp | 0 .../cxx-example/src/io/CMakeLists.txt | 0 .../recipe-07/cxx-example/src/io/io.cpp | 0 .../recipe-07/cxx-example/src/io/io.hpp | 0 .../recipe-07/cxx-example/src/main.cpp | 0 .../cxx-example/src/parser/CMakeLists.txt | 0 .../cxx-example/src/parser/parser.cpp | 0 .../cxx-example/src/parser/parser.hpp | 0 .../cxx-example/tests/CMakeLists.txt | 0 .../recipe-07/cxx-example/tests/catch.hpp | 0 .../recipe-07/cxx-example/tests/test.cpp | 0 .../recipe-07/title.txt | 0 .../recipe-08/README.md | 0 .../recipe-08/cxx-example/CMakeLists.txt | 0 .../cxx-example/external/CMakeLists.txt | 0 .../recipe-08/cxx-example/external/README.md | 0 .../cxx-example/external/conversion.cpp | 0 .../cxx-example/external/conversion.hpp | 0 .../recipe-08/cxx-example/menu.yml | 0 .../recipe-08/cxx-example/src/CMakeLists.txt | 0 .../cxx-example/src/evolution/CMakeLists.txt | 0 .../cxx-example/src/evolution/evolution.cpp | 0 .../cxx-example/src/evolution/evolution.hpp | 0 .../cxx-example/src/initial/CMakeLists.txt | 0 .../cxx-example/src/initial/initial.cpp | 0 .../cxx-example/src/initial/initial.hpp | 0 .../cxx-example/src/io/CMakeLists.txt | 0 .../recipe-08/cxx-example/src/io/io.cpp | 0 .../recipe-08/cxx-example/src/io/io.hpp | 0 .../recipe-08/cxx-example/src/main.cpp | 0 .../cxx-example/src/parser/CMakeLists.txt | 0 .../cxx-example/src/parser/parser.cpp | 0 .../cxx-example/src/parser/parser.hpp | 0 .../cxx-example/tests/CMakeLists.txt | 0 .../recipe-08/cxx-example/tests/catch.hpp | 0 .../recipe-08/cxx-example/tests/test.cpp | 0 .../recipe-08/title.txt | 0 .../recipe-09/README.md | 0 .../recipe-09/fortran-example/CMakeLists.txt | 0 .../fortran-example/external/CMakeLists.txt | 0 .../fortran-example/external/README.md | 0 .../fortran-example/external/conversion.f90 | 0 .../recipe-09/fortran-example/menu.yml | 0 .../fortran-example/src/CMakeLists.txt | 0 .../src/evolution/CMakeLists.txt | 0 .../src/evolution/ancestors.f90 | 0 .../fortran-example/src/evolution/empty.f90 | 0 .../src/evolution/evolution.f90 | 0 .../src/initial/CMakeLists.txt | 0 .../fortran-example/src/initial/initial.f90 | 0 .../fortran-example/src/io/CMakeLists.txt | 0 .../recipe-09/fortran-example/src/io/io.f90 | 0 .../recipe-09/fortran-example/src/main.f90 | 0 .../fortran-example/src/parser/CMakeLists.txt | 0 .../fortran-example/src/parser/parser.f90 | 0 .../fortran-example/tests/CMakeLists.txt | 0 .../recipe-09/fortran-example/tests/test.f90 | 0 .../recipe-09/title.txt | 0 chapter-07/title.txt | 2 +- chapter-08/README.md | 17 ++++---- chapter-08/recipe-01/README.md | 2 +- .../recipe-01/cxx-example/CMakeLists.txt | 26 +++++++----- .../recipe-01/cxx-example/src/CMakeLists.txt | 7 ++-- .../recipe-01/cxx-example/src/hello-world.cpp | 0 chapter-08/recipe-01/title.txt | 2 +- chapter-08/recipe-02/README.md | 4 +- .../recipe-02/cxx-example/CMakeLists.txt | 0 .../external/upstream/CMakeLists.txt | 0 .../external/upstream/boost/CMakeLists.txt | 0 .../recipe-02/cxx-example/src/CMakeLists.txt | 0 .../recipe-02/cxx-example/src/path-info.cpp | 0 chapter-08/recipe-02/title.txt | 2 +- chapter-08/recipe-03/README.md | 4 +- .../recipe-03/c-example/CMakeLists.txt | 0 .../external/upstream/CMakeLists.txt | 0 .../external/upstream/fftw3/CMakeLists.txt | 0 .../recipe-03/c-example/src/CMakeLists.txt | 0 .../recipe-03/c-example/src/fftw_example.c | 0 chapter-08/recipe-03/title.txt | 2 +- chapter-08/recipe-04/README.md | 3 +- .../recipe-04/cxx-example-3.5/CMakeLists.txt | 0 .../external/upstream/CMakeLists.txt | 0 .../external/upstream/eigen3/CMakeLists.txt | 0 .../recipe-04/cxx-example-3.5/menu.yml | 0 .../cxx-example-3.5/src/CMakeLists.txt | 0 .../cxx-example-3.5/src/linear-algebra.cpp | 0 .../recipe-04/cxx-example/CMakeLists.txt | 36 +++++++++------- .../external/upstream/CMakeLists.txt | 0 .../external/upstream/eigen3/CMakeLists.txt | 0 chapter-08/recipe-04/cxx-example/menu.yml | 7 +++- .../recipe-04/cxx-example/src/CMakeLists.txt | 19 ++++++--- .../cxx-example/src/linear-algebra.cpp | 0 chapter-08/recipe-04/title.txt | 2 +- chapter-08/recipe-05/README.md | 4 +- .../recipe-05/fortran-example/CMakeLists.txt | 0 .../external/upstream/CMakeLists.txt | 0 .../external/upstream/hdf5/CMakeLists.txt | 0 .../hdf5/test_hdf5_has_fortran2003.f90 | 0 .../recipe-05/fortran-example/menu.yml | 0 .../fortran-example/src/CMakeLists.txt | 0 .../src/compound_fortran2003.f90 | 0 .../src/test_hdf5_has_fortran2003.f90 | 0 chapter-08/recipe-05/title.txt | 2 +- chapter-08/recipe-06/README.md | 4 +- .../recipe-06/cxx-example/CMakeLists.txt | 0 .../external/upstream/CMakeLists.txt | 0 .../external/upstream/message/CMakeLists.txt | 0 .../recipe-06/cxx-example/src/CMakeLists.txt | 0 .../recipe-06/cxx-example/src/use_message.cpp | 0 chapter-08/recipe-06/title.txt | 2 +- chapter-08/title.txt | 2 +- 166 files changed, 168 insertions(+), 168 deletions(-) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/menu.yml (100%) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/src/main.cpp (100%) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/src/sum_integers.cpp (100%) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/src/sum_integers.hpp (100%) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/tests/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/tests/catch.hpp (100%) rename {chapter-08 => chapter-07}/recipe-01/cxx-example/tests/test.cpp (100%) rename {chapter-08 => chapter-07}/recipe-02/example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-02/example/cmake/colors.cmake (100%) rename {chapter-08 => chapter-07}/recipe-03/example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-03/example/set_compiler_flag.cmake (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/cmake/testing.cmake (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/src/main.cpp (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/src/sum_integers.cpp (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/src/sum_integers.hpp (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/tests/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/tests/catch.hpp (100%) rename {chapter-08 => chapter-07}/recipe-04/cxx-example/tests/test.cpp (100%) rename {chapter-08 => chapter-07}/recipe-05/example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-05/example/cmake/custom.cmake (100%) rename {chapter-08 => chapter-07}/recipe-05/example/cmake/include_guard.cmake (100%) rename {chapter-08 => chapter-07}/recipe-06/example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-06/example/cmake/custom.cmake (100%) rename {chapter-08 => chapter-07}/recipe-07/README.md (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/external/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/external/README.md (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/external/conversion.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/external/conversion.hpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/menu.yml (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/evolution/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/evolution/evolution.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/evolution/evolution.hpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/initial/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/initial/initial.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/initial/initial.hpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/io/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/io/io.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/io/io.hpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/main.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/parser/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/parser/parser.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/src/parser/parser.hpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/tests/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/tests/catch.hpp (100%) rename {chapter-08 => chapter-07}/recipe-07/cxx-example/tests/test.cpp (100%) rename {chapter-08 => chapter-07}/recipe-07/title.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/README.md (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/external/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/external/README.md (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/external/conversion.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/external/conversion.hpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/menu.yml (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/evolution/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/evolution/evolution.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/evolution/evolution.hpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/initial/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/initial/initial.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/initial/initial.hpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/io/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/io/io.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/io/io.hpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/main.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/parser/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/parser/parser.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/src/parser/parser.hpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/tests/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/tests/catch.hpp (100%) rename {chapter-08 => chapter-07}/recipe-08/cxx-example/tests/test.cpp (100%) rename {chapter-08 => chapter-07}/recipe-08/title.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/README.md (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/external/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/external/README.md (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/external/conversion.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/menu.yml (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/evolution/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/evolution/ancestors.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/evolution/empty.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/evolution/evolution.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/initial/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/initial/initial.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/io/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/io/io.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/main.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/parser/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/src/parser/parser.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/tests/CMakeLists.txt (100%) rename {chapter-08 => chapter-07}/recipe-09/fortran-example/tests/test.f90 (100%) rename {chapter-08 => chapter-07}/recipe-09/title.txt (100%) rename {chapter-07 => chapter-08}/recipe-01/cxx-example/src/hello-world.cpp (100%) rename {chapter-07 => chapter-08}/recipe-02/cxx-example/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-02/cxx-example/external/upstream/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-02/cxx-example/src/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-02/cxx-example/src/path-info.cpp (100%) rename {chapter-07 => chapter-08}/recipe-03/c-example/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-03/c-example/external/upstream/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-03/c-example/external/upstream/fftw3/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-03/c-example/src/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-03/c-example/src/fftw_example.c (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example-3.5/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example-3.5/external/upstream/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example-3.5/external/upstream/eigen3/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example-3.5/menu.yml (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example-3.5/src/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example-3.5/src/linear-algebra.cpp (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example/external/upstream/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example/external/upstream/eigen3/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-04/cxx-example/src/linear-algebra.cpp (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/external/upstream/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/external/upstream/hdf5/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/external/upstream/hdf5/test_hdf5_has_fortran2003.f90 (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/menu.yml (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/src/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/src/compound_fortran2003.f90 (100%) rename {chapter-07 => chapter-08}/recipe-05/fortran-example/src/test_hdf5_has_fortran2003.f90 (100%) rename {chapter-07 => chapter-08}/recipe-06/cxx-example/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-06/cxx-example/external/upstream/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-06/cxx-example/external/upstream/message/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-06/cxx-example/src/CMakeLists.txt (100%) rename {chapter-07 => chapter-08}/recipe-06/cxx-example/src/use_message.cpp (100%) diff --git a/README.md b/README.md index 08103c78a..2c48157e7 100644 --- a/README.md +++ b/README.md @@ -95,27 +95,27 @@ - [Recording the Git hash at build-time](chapter-06/recipe-07/README.md) -### [Chapter 7: The Superbuild Pattern](chapter-07/README.md) - -- [Using the superbuild pattern](chapter-07/recipe-01/README.md) -- [Managing dependencies with a superbuild I. The Boost libraries](chapter-07/recipe-02/README.md) -- [Managing dependencies with a superbuild II. The FFTW library](chapter-07/recipe-03/README.md) -- [Managing dependencies with a superbuild III. The Eigen library](chapter-07/recipe-04/README.md) -- [Managing dependencies with a superbuild IV. The HDF5 library](chapter-07/recipe-05/README.md) -- [Managing your project as a superbuild](chapter-07/recipe-06/README.md) - - -### [Chapter 8: Structuring Projects](chapter-08/README.md) - -- [Defining a macro with named arguments](chapter-08/recipe-01/README.md) -- [Splitting CMake sources into modules](chapter-08/recipe-02/README.md) -- [Function to test and set compiler flags](chapter-08/recipe-03/README.md) -- [Defining a function or macro with named arguments](chapter-08/recipe-04/README.md) -- [Redefining functions and macros](chapter-08/recipe-05/README.md) -- [Deprecating functions, macros, and variables](chapter-08/recipe-06/README.md) -- [Limiting scope with add_subdirectory](chapter-08/recipe-07/README.md) -- [Avoiding global variables using target_sources](chapter-08/recipe-08/README.md) -- [Organizing Fortran projects](chapter-08/recipe-09/README.md) +### [Chapter 7: Structuring Projects](chapter-07/README.md) + +- [Defining a macro with named arguments](chapter-07/recipe-01/README.md) +- [Splitting CMake sources into modules](chapter-07/recipe-02/README.md) +- [Function to test and set compiler flags](chapter-07/recipe-03/README.md) +- [Defining a function or macro with named arguments](chapter-07/recipe-04/README.md) +- [Redefining functions and macros](chapter-07/recipe-05/README.md) +- [Deprecating functions, macros, and variables](chapter-07/recipe-06/README.md) +- [Limiting scope with add_subdirectory](chapter-07/recipe-07/README.md) +- [Avoiding global variables using target_sources](chapter-07/recipe-08/README.md) +- [Organizing Fortran projects](chapter-07/recipe-09/README.md) + + +### [Chapter 8: The Superbuild Pattern](chapter-08/README.md) + +- [Using the superbuild pattern](chapter-08/recipe-01/README.md) +- [Managing dependencies with a superbuild I. The Boost libraries](chapter-08/recipe-02/README.md) +- [Managing dependencies with a superbuild II. The FFTW library](chapter-08/recipe-03/README.md) +- [Managing dependencies with a superbuild III. The Eigen library](chapter-08/recipe-04/README.md) +- [Managing dependencies with a superbuild IV. The HDF5 library](chapter-08/recipe-05/README.md) +- [Managing your project as a superbuild](chapter-08/recipe-06/README.md) ### [Chapter 9: Mixed-language Projects](chapter-09/README.md) diff --git a/chapter-07/README.md b/chapter-07/README.md index 85a9ab9e4..c842c1c8b 100644 --- a/chapter-07/README.md +++ b/chapter-07/README.md @@ -1,8 +1,11 @@ -# Chapter 7: The Superbuild Pattern +# Chapter 7: Structuring Projects -- [Using the superbuild pattern](recipe-01/README.md) -- [Managing dependencies with a superbuild I. The Boost libraries](recipe-02/README.md) -- [Managing dependencies with a superbuild II. The FFTW library](recipe-03/README.md) -- [Managing dependencies with a superbuild III. The Eigen library](recipe-04/README.md) -- [Managing dependencies with a superbuild IV. The HDF5 library](recipe-05/README.md) -- [Managing your project as a superbuild](recipe-06/README.md) +- [Defining a macro with named arguments](recipe-01/README.md) +- [Splitting CMake sources into modules](recipe-02/README.md) +- [Function to test and set compiler flags](recipe-03/README.md) +- [Defining a function or macro with named arguments](recipe-04/README.md) +- [Redefining functions and macros](recipe-05/README.md) +- [Deprecating functions, macros, and variables](recipe-06/README.md) +- [Limiting scope with add_subdirectory](recipe-07/README.md) +- [Avoiding global variables using target_sources](recipe-08/README.md) +- [Organizing Fortran projects](recipe-09/README.md) diff --git a/chapter-07/recipe-01/README.md b/chapter-07/recipe-01/README.md index c7a071203..4bc3299dc 100644 --- a/chapter-07/recipe-01/README.md +++ b/chapter-07/recipe-01/README.md @@ -1,4 +1,4 @@ -# Using the superbuild pattern +# Defining a macro with named arguments Abstract to be written ... diff --git a/chapter-07/recipe-01/cxx-example/CMakeLists.txt b/chapter-07/recipe-01/cxx-example/CMakeLists.txt index bd33464b9..e8222b1ad 100644 --- a/chapter-07/recipe-01/cxx-example/CMakeLists.txt +++ b/chapter-07/recipe-01/cxx-example/CMakeLists.txt @@ -6,19 +6,13 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -include(ExternalProject) -ExternalProject_Add(${PROJECT_NAME}_core - SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/src - CMAKE_ARGS - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} - -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} - CMAKE_CACHE_ARGS - -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} - BUILD_ALWAYS - 1 - INSTALL_COMMAND - "" - ) +include(GNUInstallDirs) + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + +add_subdirectory(src) + +enable_testing() +add_subdirectory(tests) diff --git a/chapter-08/recipe-01/cxx-example/menu.yml b/chapter-07/recipe-01/cxx-example/menu.yml similarity index 100% rename from chapter-08/recipe-01/cxx-example/menu.yml rename to chapter-07/recipe-01/cxx-example/menu.yml diff --git a/chapter-07/recipe-01/cxx-example/src/CMakeLists.txt b/chapter-07/recipe-01/cxx-example/src/CMakeLists.txt index 6498e13c0..8f08cc44b 100644 --- a/chapter-07/recipe-01/cxx-example/src/CMakeLists.txt +++ b/chapter-07/recipe-01/cxx-example/src/CMakeLists.txt @@ -1,5 +1,6 @@ -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) -project(recipe-01_core LANGUAGES CXX) +add_library(sum_integers sum_integers.cpp) -add_executable(hello-world hello-world.cpp) +add_executable(sum_up main.cpp) +target_link_libraries(sum_up sum_integers) diff --git a/chapter-08/recipe-01/cxx-example/src/main.cpp b/chapter-07/recipe-01/cxx-example/src/main.cpp similarity index 100% rename from chapter-08/recipe-01/cxx-example/src/main.cpp rename to chapter-07/recipe-01/cxx-example/src/main.cpp diff --git a/chapter-08/recipe-01/cxx-example/src/sum_integers.cpp b/chapter-07/recipe-01/cxx-example/src/sum_integers.cpp similarity index 100% rename from chapter-08/recipe-01/cxx-example/src/sum_integers.cpp rename to chapter-07/recipe-01/cxx-example/src/sum_integers.cpp diff --git a/chapter-08/recipe-01/cxx-example/src/sum_integers.hpp b/chapter-07/recipe-01/cxx-example/src/sum_integers.hpp similarity index 100% rename from chapter-08/recipe-01/cxx-example/src/sum_integers.hpp rename to chapter-07/recipe-01/cxx-example/src/sum_integers.hpp diff --git a/chapter-08/recipe-01/cxx-example/tests/CMakeLists.txt b/chapter-07/recipe-01/cxx-example/tests/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-01/cxx-example/tests/CMakeLists.txt rename to chapter-07/recipe-01/cxx-example/tests/CMakeLists.txt diff --git a/chapter-08/recipe-01/cxx-example/tests/catch.hpp b/chapter-07/recipe-01/cxx-example/tests/catch.hpp similarity index 100% rename from chapter-08/recipe-01/cxx-example/tests/catch.hpp rename to chapter-07/recipe-01/cxx-example/tests/catch.hpp diff --git a/chapter-08/recipe-01/cxx-example/tests/test.cpp b/chapter-07/recipe-01/cxx-example/tests/test.cpp similarity index 100% rename from chapter-08/recipe-01/cxx-example/tests/test.cpp rename to chapter-07/recipe-01/cxx-example/tests/test.cpp diff --git a/chapter-07/recipe-01/title.txt b/chapter-07/recipe-01/title.txt index 3b58d88f6..1f3132a19 100644 --- a/chapter-07/recipe-01/title.txt +++ b/chapter-07/recipe-01/title.txt @@ -1 +1 @@ -Using the superbuild pattern +Defining a macro with named arguments diff --git a/chapter-07/recipe-02/README.md b/chapter-07/recipe-02/README.md index a2011cf16..c509f5c5a 100644 --- a/chapter-07/recipe-02/README.md +++ b/chapter-07/recipe-02/README.md @@ -1,5 +1,5 @@ -# Managing dependencies with a superbuild I. The Boost libraries +# Splitting CMake sources into modules Abstract to be written ... -- [cxx-example](cxx-example/) +- [example](example/) diff --git a/chapter-08/recipe-02/example/CMakeLists.txt b/chapter-07/recipe-02/example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-02/example/CMakeLists.txt rename to chapter-07/recipe-02/example/CMakeLists.txt diff --git a/chapter-08/recipe-02/example/cmake/colors.cmake b/chapter-07/recipe-02/example/cmake/colors.cmake similarity index 100% rename from chapter-08/recipe-02/example/cmake/colors.cmake rename to chapter-07/recipe-02/example/cmake/colors.cmake diff --git a/chapter-07/recipe-02/title.txt b/chapter-07/recipe-02/title.txt index befbc9f90..fcec1d8d1 100644 --- a/chapter-07/recipe-02/title.txt +++ b/chapter-07/recipe-02/title.txt @@ -1 +1 @@ -Managing dependencies with a superbuild I. The Boost libraries +Splitting CMake sources into modules diff --git a/chapter-07/recipe-03/README.md b/chapter-07/recipe-03/README.md index d21282d56..acfe9daad 100644 --- a/chapter-07/recipe-03/README.md +++ b/chapter-07/recipe-03/README.md @@ -1,5 +1,5 @@ -# Managing dependencies with a superbuild II. The FFTW library +# Function to test and set compiler flags Abstract to be written ... -- [c-example](c-example/) +- [example](example/) diff --git a/chapter-08/recipe-03/example/CMakeLists.txt b/chapter-07/recipe-03/example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-03/example/CMakeLists.txt rename to chapter-07/recipe-03/example/CMakeLists.txt diff --git a/chapter-08/recipe-03/example/set_compiler_flag.cmake b/chapter-07/recipe-03/example/set_compiler_flag.cmake similarity index 100% rename from chapter-08/recipe-03/example/set_compiler_flag.cmake rename to chapter-07/recipe-03/example/set_compiler_flag.cmake diff --git a/chapter-07/recipe-03/title.txt b/chapter-07/recipe-03/title.txt index 38d46d1e8..41e922ab4 100644 --- a/chapter-07/recipe-03/title.txt +++ b/chapter-07/recipe-03/title.txt @@ -1 +1 @@ -Managing dependencies with a superbuild II. The FFTW library +Function to test and set compiler flags diff --git a/chapter-07/recipe-04/README.md b/chapter-07/recipe-04/README.md index b1abd9e8f..2b3cd4584 100644 --- a/chapter-07/recipe-04/README.md +++ b/chapter-07/recipe-04/README.md @@ -1,6 +1,5 @@ -# Managing dependencies with a superbuild III. The Eigen library +# Defining a function or macro with named arguments Abstract to be written ... - [cxx-example](cxx-example/) -- [cxx-example-3.5](cxx-example-3.5/) diff --git a/chapter-07/recipe-04/cxx-example/CMakeLists.txt b/chapter-07/recipe-04/cxx-example/CMakeLists.txt index 6bcba9003..c1d4e87c1 100644 --- a/chapter-07/recipe-04/cxx-example/CMakeLists.txt +++ b/chapter-07/recipe-04/cxx-example/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-04 LANGUAGES CXX) @@ -6,25 +6,17 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -add_subdirectory(external/upstream) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") -include(ExternalProject) -ExternalProject_Add(${PROJECT_NAME}_core - DEPENDS - eigen3_external - SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/src - CMAKE_ARGS - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} - -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} - -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} - -DEigen3_DIR=${Eigen3_DIR} - CMAKE_CACHE_ARGS - -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} - -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} - BUILD_ALWAYS - 1 - INSTALL_COMMAND - "" - ) +include(GNUInstallDirs) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + +add_subdirectory(src) + +enable_testing() +add_subdirectory(tests) diff --git a/chapter-08/recipe-04/cxx-example/cmake/testing.cmake b/chapter-07/recipe-04/cxx-example/cmake/testing.cmake similarity index 100% rename from chapter-08/recipe-04/cxx-example/cmake/testing.cmake rename to chapter-07/recipe-04/cxx-example/cmake/testing.cmake diff --git a/chapter-07/recipe-04/cxx-example/menu.yml b/chapter-07/recipe-04/cxx-example/menu.yml index a1b2ac465..6c5ad3628 100644 --- a/chapter-07/recipe-04/cxx-example/menu.yml +++ b/chapter-07/recipe-04/cxx-example/menu.yml @@ -1,5 +1,2 @@ -# OpenMP does not work with clang -travis-osx: - failing_generators: - - 'Unix Makefiles' - - 'Ninja' +targets: + - test diff --git a/chapter-07/recipe-04/cxx-example/src/CMakeLists.txt b/chapter-07/recipe-04/cxx-example/src/CMakeLists.txt index a1ee51fc7..695defc6c 100644 --- a/chapter-07/recipe-04/cxx-example/src/CMakeLists.txt +++ b/chapter-07/recipe-04/cxx-example/src/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.9 FATAL_ERROR) +# adds current directory to INTERFACE_INCLUDE_DIRECTORIES +# for targets defined below +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) -project(recipe-04_core LANGUAGES CXX) +add_library(sum_integers sum_integers.cpp) -find_package(OpenMP REQUIRED) - -find_package(Eigen3 3.3.4 REQUIRED CONFIG) -message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR} (found version ${EIGEN3_VERSION_STRING})") - -add_executable(linear-algebra linear-algebra.cpp) -target_link_libraries(linear-algebra - PUBLIC - Eigen3::Eigen - OpenMP::OpenMP_CXX - ) +add_executable(sum_up main.cpp) +target_link_libraries(sum_up sum_integers) diff --git a/chapter-08/recipe-04/cxx-example/src/main.cpp b/chapter-07/recipe-04/cxx-example/src/main.cpp similarity index 100% rename from chapter-08/recipe-04/cxx-example/src/main.cpp rename to chapter-07/recipe-04/cxx-example/src/main.cpp diff --git a/chapter-08/recipe-04/cxx-example/src/sum_integers.cpp b/chapter-07/recipe-04/cxx-example/src/sum_integers.cpp similarity index 100% rename from chapter-08/recipe-04/cxx-example/src/sum_integers.cpp rename to chapter-07/recipe-04/cxx-example/src/sum_integers.cpp diff --git a/chapter-08/recipe-04/cxx-example/src/sum_integers.hpp b/chapter-07/recipe-04/cxx-example/src/sum_integers.hpp similarity index 100% rename from chapter-08/recipe-04/cxx-example/src/sum_integers.hpp rename to chapter-07/recipe-04/cxx-example/src/sum_integers.hpp diff --git a/chapter-08/recipe-04/cxx-example/tests/CMakeLists.txt b/chapter-07/recipe-04/cxx-example/tests/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-04/cxx-example/tests/CMakeLists.txt rename to chapter-07/recipe-04/cxx-example/tests/CMakeLists.txt diff --git a/chapter-08/recipe-04/cxx-example/tests/catch.hpp b/chapter-07/recipe-04/cxx-example/tests/catch.hpp similarity index 100% rename from chapter-08/recipe-04/cxx-example/tests/catch.hpp rename to chapter-07/recipe-04/cxx-example/tests/catch.hpp diff --git a/chapter-08/recipe-04/cxx-example/tests/test.cpp b/chapter-07/recipe-04/cxx-example/tests/test.cpp similarity index 100% rename from chapter-08/recipe-04/cxx-example/tests/test.cpp rename to chapter-07/recipe-04/cxx-example/tests/test.cpp diff --git a/chapter-07/recipe-04/title.txt b/chapter-07/recipe-04/title.txt index f95176a18..0db2b2bea 100644 --- a/chapter-07/recipe-04/title.txt +++ b/chapter-07/recipe-04/title.txt @@ -1 +1 @@ -Managing dependencies with a superbuild III. The Eigen library +Defining a function or macro with named arguments diff --git a/chapter-07/recipe-05/README.md b/chapter-07/recipe-05/README.md index bd65595cf..64b238cb5 100644 --- a/chapter-07/recipe-05/README.md +++ b/chapter-07/recipe-05/README.md @@ -1,5 +1,5 @@ -# Managing dependencies with a superbuild IV. The HDF5 library +# Redefining functions and macros Abstract to be written ... -- [fortran-example](fortran-example/) +- [example](example/) diff --git a/chapter-08/recipe-05/example/CMakeLists.txt b/chapter-07/recipe-05/example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-05/example/CMakeLists.txt rename to chapter-07/recipe-05/example/CMakeLists.txt diff --git a/chapter-08/recipe-05/example/cmake/custom.cmake b/chapter-07/recipe-05/example/cmake/custom.cmake similarity index 100% rename from chapter-08/recipe-05/example/cmake/custom.cmake rename to chapter-07/recipe-05/example/cmake/custom.cmake diff --git a/chapter-08/recipe-05/example/cmake/include_guard.cmake b/chapter-07/recipe-05/example/cmake/include_guard.cmake similarity index 100% rename from chapter-08/recipe-05/example/cmake/include_guard.cmake rename to chapter-07/recipe-05/example/cmake/include_guard.cmake diff --git a/chapter-07/recipe-05/title.txt b/chapter-07/recipe-05/title.txt index 18c480e81..a2abc9393 100644 --- a/chapter-07/recipe-05/title.txt +++ b/chapter-07/recipe-05/title.txt @@ -1 +1 @@ -Managing dependencies with a superbuild IV. The HDF5 library +Redefining functions and macros diff --git a/chapter-07/recipe-06/README.md b/chapter-07/recipe-06/README.md index 2afbe272c..884ab5482 100644 --- a/chapter-07/recipe-06/README.md +++ b/chapter-07/recipe-06/README.md @@ -1,5 +1,5 @@ -# Managing your project as a superbuild +# Deprecating functions, macros, and variables Abstract to be written ... -- [cxx-example](cxx-example/) +- [example](example/) diff --git a/chapter-08/recipe-06/example/CMakeLists.txt b/chapter-07/recipe-06/example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-06/example/CMakeLists.txt rename to chapter-07/recipe-06/example/CMakeLists.txt diff --git a/chapter-08/recipe-06/example/cmake/custom.cmake b/chapter-07/recipe-06/example/cmake/custom.cmake similarity index 100% rename from chapter-08/recipe-06/example/cmake/custom.cmake rename to chapter-07/recipe-06/example/cmake/custom.cmake diff --git a/chapter-07/recipe-06/title.txt b/chapter-07/recipe-06/title.txt index 16ea95af7..4efe861c6 100644 --- a/chapter-07/recipe-06/title.txt +++ b/chapter-07/recipe-06/title.txt @@ -1 +1 @@ -Managing your project as a superbuild +Deprecating functions, macros, and variables diff --git a/chapter-08/recipe-07/README.md b/chapter-07/recipe-07/README.md similarity index 100% rename from chapter-08/recipe-07/README.md rename to chapter-07/recipe-07/README.md diff --git a/chapter-08/recipe-07/cxx-example/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/external/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/external/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/external/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/external/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/external/README.md b/chapter-07/recipe-07/cxx-example/external/README.md similarity index 100% rename from chapter-08/recipe-07/cxx-example/external/README.md rename to chapter-07/recipe-07/cxx-example/external/README.md diff --git a/chapter-08/recipe-07/cxx-example/external/conversion.cpp b/chapter-07/recipe-07/cxx-example/external/conversion.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/external/conversion.cpp rename to chapter-07/recipe-07/cxx-example/external/conversion.cpp diff --git a/chapter-08/recipe-07/cxx-example/external/conversion.hpp b/chapter-07/recipe-07/cxx-example/external/conversion.hpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/external/conversion.hpp rename to chapter-07/recipe-07/cxx-example/external/conversion.hpp diff --git a/chapter-08/recipe-07/cxx-example/menu.yml b/chapter-07/recipe-07/cxx-example/menu.yml similarity index 100% rename from chapter-08/recipe-07/cxx-example/menu.yml rename to chapter-07/recipe-07/cxx-example/menu.yml diff --git a/chapter-08/recipe-07/cxx-example/src/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/src/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/src/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/src/evolution/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/src/evolution/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/evolution/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/src/evolution/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/src/evolution/evolution.cpp b/chapter-07/recipe-07/cxx-example/src/evolution/evolution.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/evolution/evolution.cpp rename to chapter-07/recipe-07/cxx-example/src/evolution/evolution.cpp diff --git a/chapter-08/recipe-07/cxx-example/src/evolution/evolution.hpp b/chapter-07/recipe-07/cxx-example/src/evolution/evolution.hpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/evolution/evolution.hpp rename to chapter-07/recipe-07/cxx-example/src/evolution/evolution.hpp diff --git a/chapter-08/recipe-07/cxx-example/src/initial/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/src/initial/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/initial/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/src/initial/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/src/initial/initial.cpp b/chapter-07/recipe-07/cxx-example/src/initial/initial.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/initial/initial.cpp rename to chapter-07/recipe-07/cxx-example/src/initial/initial.cpp diff --git a/chapter-08/recipe-07/cxx-example/src/initial/initial.hpp b/chapter-07/recipe-07/cxx-example/src/initial/initial.hpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/initial/initial.hpp rename to chapter-07/recipe-07/cxx-example/src/initial/initial.hpp diff --git a/chapter-08/recipe-07/cxx-example/src/io/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/src/io/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/io/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/src/io/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/src/io/io.cpp b/chapter-07/recipe-07/cxx-example/src/io/io.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/io/io.cpp rename to chapter-07/recipe-07/cxx-example/src/io/io.cpp diff --git a/chapter-08/recipe-07/cxx-example/src/io/io.hpp b/chapter-07/recipe-07/cxx-example/src/io/io.hpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/io/io.hpp rename to chapter-07/recipe-07/cxx-example/src/io/io.hpp diff --git a/chapter-08/recipe-07/cxx-example/src/main.cpp b/chapter-07/recipe-07/cxx-example/src/main.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/main.cpp rename to chapter-07/recipe-07/cxx-example/src/main.cpp diff --git a/chapter-08/recipe-07/cxx-example/src/parser/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/src/parser/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/parser/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/src/parser/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/src/parser/parser.cpp b/chapter-07/recipe-07/cxx-example/src/parser/parser.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/parser/parser.cpp rename to chapter-07/recipe-07/cxx-example/src/parser/parser.cpp diff --git a/chapter-08/recipe-07/cxx-example/src/parser/parser.hpp b/chapter-07/recipe-07/cxx-example/src/parser/parser.hpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/src/parser/parser.hpp rename to chapter-07/recipe-07/cxx-example/src/parser/parser.hpp diff --git a/chapter-08/recipe-07/cxx-example/tests/CMakeLists.txt b/chapter-07/recipe-07/cxx-example/tests/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-07/cxx-example/tests/CMakeLists.txt rename to chapter-07/recipe-07/cxx-example/tests/CMakeLists.txt diff --git a/chapter-08/recipe-07/cxx-example/tests/catch.hpp b/chapter-07/recipe-07/cxx-example/tests/catch.hpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/tests/catch.hpp rename to chapter-07/recipe-07/cxx-example/tests/catch.hpp diff --git a/chapter-08/recipe-07/cxx-example/tests/test.cpp b/chapter-07/recipe-07/cxx-example/tests/test.cpp similarity index 100% rename from chapter-08/recipe-07/cxx-example/tests/test.cpp rename to chapter-07/recipe-07/cxx-example/tests/test.cpp diff --git a/chapter-08/recipe-07/title.txt b/chapter-07/recipe-07/title.txt similarity index 100% rename from chapter-08/recipe-07/title.txt rename to chapter-07/recipe-07/title.txt diff --git a/chapter-08/recipe-08/README.md b/chapter-07/recipe-08/README.md similarity index 100% rename from chapter-08/recipe-08/README.md rename to chapter-07/recipe-08/README.md diff --git a/chapter-08/recipe-08/cxx-example/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/external/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/external/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/external/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/external/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/external/README.md b/chapter-07/recipe-08/cxx-example/external/README.md similarity index 100% rename from chapter-08/recipe-08/cxx-example/external/README.md rename to chapter-07/recipe-08/cxx-example/external/README.md diff --git a/chapter-08/recipe-08/cxx-example/external/conversion.cpp b/chapter-07/recipe-08/cxx-example/external/conversion.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/external/conversion.cpp rename to chapter-07/recipe-08/cxx-example/external/conversion.cpp diff --git a/chapter-08/recipe-08/cxx-example/external/conversion.hpp b/chapter-07/recipe-08/cxx-example/external/conversion.hpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/external/conversion.hpp rename to chapter-07/recipe-08/cxx-example/external/conversion.hpp diff --git a/chapter-08/recipe-08/cxx-example/menu.yml b/chapter-07/recipe-08/cxx-example/menu.yml similarity index 100% rename from chapter-08/recipe-08/cxx-example/menu.yml rename to chapter-07/recipe-08/cxx-example/menu.yml diff --git a/chapter-08/recipe-08/cxx-example/src/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/src/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/src/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/src/evolution/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/src/evolution/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/evolution/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/src/evolution/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/src/evolution/evolution.cpp b/chapter-07/recipe-08/cxx-example/src/evolution/evolution.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/evolution/evolution.cpp rename to chapter-07/recipe-08/cxx-example/src/evolution/evolution.cpp diff --git a/chapter-08/recipe-08/cxx-example/src/evolution/evolution.hpp b/chapter-07/recipe-08/cxx-example/src/evolution/evolution.hpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/evolution/evolution.hpp rename to chapter-07/recipe-08/cxx-example/src/evolution/evolution.hpp diff --git a/chapter-08/recipe-08/cxx-example/src/initial/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/src/initial/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/initial/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/src/initial/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/src/initial/initial.cpp b/chapter-07/recipe-08/cxx-example/src/initial/initial.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/initial/initial.cpp rename to chapter-07/recipe-08/cxx-example/src/initial/initial.cpp diff --git a/chapter-08/recipe-08/cxx-example/src/initial/initial.hpp b/chapter-07/recipe-08/cxx-example/src/initial/initial.hpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/initial/initial.hpp rename to chapter-07/recipe-08/cxx-example/src/initial/initial.hpp diff --git a/chapter-08/recipe-08/cxx-example/src/io/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/src/io/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/io/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/src/io/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/src/io/io.cpp b/chapter-07/recipe-08/cxx-example/src/io/io.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/io/io.cpp rename to chapter-07/recipe-08/cxx-example/src/io/io.cpp diff --git a/chapter-08/recipe-08/cxx-example/src/io/io.hpp b/chapter-07/recipe-08/cxx-example/src/io/io.hpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/io/io.hpp rename to chapter-07/recipe-08/cxx-example/src/io/io.hpp diff --git a/chapter-08/recipe-08/cxx-example/src/main.cpp b/chapter-07/recipe-08/cxx-example/src/main.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/main.cpp rename to chapter-07/recipe-08/cxx-example/src/main.cpp diff --git a/chapter-08/recipe-08/cxx-example/src/parser/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/src/parser/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/parser/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/src/parser/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/src/parser/parser.cpp b/chapter-07/recipe-08/cxx-example/src/parser/parser.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/parser/parser.cpp rename to chapter-07/recipe-08/cxx-example/src/parser/parser.cpp diff --git a/chapter-08/recipe-08/cxx-example/src/parser/parser.hpp b/chapter-07/recipe-08/cxx-example/src/parser/parser.hpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/src/parser/parser.hpp rename to chapter-07/recipe-08/cxx-example/src/parser/parser.hpp diff --git a/chapter-08/recipe-08/cxx-example/tests/CMakeLists.txt b/chapter-07/recipe-08/cxx-example/tests/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-08/cxx-example/tests/CMakeLists.txt rename to chapter-07/recipe-08/cxx-example/tests/CMakeLists.txt diff --git a/chapter-08/recipe-08/cxx-example/tests/catch.hpp b/chapter-07/recipe-08/cxx-example/tests/catch.hpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/tests/catch.hpp rename to chapter-07/recipe-08/cxx-example/tests/catch.hpp diff --git a/chapter-08/recipe-08/cxx-example/tests/test.cpp b/chapter-07/recipe-08/cxx-example/tests/test.cpp similarity index 100% rename from chapter-08/recipe-08/cxx-example/tests/test.cpp rename to chapter-07/recipe-08/cxx-example/tests/test.cpp diff --git a/chapter-08/recipe-08/title.txt b/chapter-07/recipe-08/title.txt similarity index 100% rename from chapter-08/recipe-08/title.txt rename to chapter-07/recipe-08/title.txt diff --git a/chapter-08/recipe-09/README.md b/chapter-07/recipe-09/README.md similarity index 100% rename from chapter-08/recipe-09/README.md rename to chapter-07/recipe-09/README.md diff --git a/chapter-08/recipe-09/fortran-example/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/external/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/external/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/external/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/external/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/external/README.md b/chapter-07/recipe-09/fortran-example/external/README.md similarity index 100% rename from chapter-08/recipe-09/fortran-example/external/README.md rename to chapter-07/recipe-09/fortran-example/external/README.md diff --git a/chapter-08/recipe-09/fortran-example/external/conversion.f90 b/chapter-07/recipe-09/fortran-example/external/conversion.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/external/conversion.f90 rename to chapter-07/recipe-09/fortran-example/external/conversion.f90 diff --git a/chapter-08/recipe-09/fortran-example/menu.yml b/chapter-07/recipe-09/fortran-example/menu.yml similarity index 100% rename from chapter-08/recipe-09/fortran-example/menu.yml rename to chapter-07/recipe-09/fortran-example/menu.yml diff --git a/chapter-08/recipe-09/fortran-example/src/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/src/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/src/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/src/evolution/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/src/evolution/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/evolution/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/src/evolution/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/src/evolution/ancestors.f90 b/chapter-07/recipe-09/fortran-example/src/evolution/ancestors.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/evolution/ancestors.f90 rename to chapter-07/recipe-09/fortran-example/src/evolution/ancestors.f90 diff --git a/chapter-08/recipe-09/fortran-example/src/evolution/empty.f90 b/chapter-07/recipe-09/fortran-example/src/evolution/empty.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/evolution/empty.f90 rename to chapter-07/recipe-09/fortran-example/src/evolution/empty.f90 diff --git a/chapter-08/recipe-09/fortran-example/src/evolution/evolution.f90 b/chapter-07/recipe-09/fortran-example/src/evolution/evolution.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/evolution/evolution.f90 rename to chapter-07/recipe-09/fortran-example/src/evolution/evolution.f90 diff --git a/chapter-08/recipe-09/fortran-example/src/initial/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/src/initial/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/initial/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/src/initial/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/src/initial/initial.f90 b/chapter-07/recipe-09/fortran-example/src/initial/initial.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/initial/initial.f90 rename to chapter-07/recipe-09/fortran-example/src/initial/initial.f90 diff --git a/chapter-08/recipe-09/fortran-example/src/io/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/src/io/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/io/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/src/io/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/src/io/io.f90 b/chapter-07/recipe-09/fortran-example/src/io/io.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/io/io.f90 rename to chapter-07/recipe-09/fortran-example/src/io/io.f90 diff --git a/chapter-08/recipe-09/fortran-example/src/main.f90 b/chapter-07/recipe-09/fortran-example/src/main.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/main.f90 rename to chapter-07/recipe-09/fortran-example/src/main.f90 diff --git a/chapter-08/recipe-09/fortran-example/src/parser/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/src/parser/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/parser/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/src/parser/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/src/parser/parser.f90 b/chapter-07/recipe-09/fortran-example/src/parser/parser.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/src/parser/parser.f90 rename to chapter-07/recipe-09/fortran-example/src/parser/parser.f90 diff --git a/chapter-08/recipe-09/fortran-example/tests/CMakeLists.txt b/chapter-07/recipe-09/fortran-example/tests/CMakeLists.txt similarity index 100% rename from chapter-08/recipe-09/fortran-example/tests/CMakeLists.txt rename to chapter-07/recipe-09/fortran-example/tests/CMakeLists.txt diff --git a/chapter-08/recipe-09/fortran-example/tests/test.f90 b/chapter-07/recipe-09/fortran-example/tests/test.f90 similarity index 100% rename from chapter-08/recipe-09/fortran-example/tests/test.f90 rename to chapter-07/recipe-09/fortran-example/tests/test.f90 diff --git a/chapter-08/recipe-09/title.txt b/chapter-07/recipe-09/title.txt similarity index 100% rename from chapter-08/recipe-09/title.txt rename to chapter-07/recipe-09/title.txt diff --git a/chapter-07/title.txt b/chapter-07/title.txt index 7049ced78..fe06cb162 100644 --- a/chapter-07/title.txt +++ b/chapter-07/title.txt @@ -1 +1 @@ -The Superbuild Pattern +Structuring Projects diff --git a/chapter-08/README.md b/chapter-08/README.md index 96cf8c499..c0d06ea44 100644 --- a/chapter-08/README.md +++ b/chapter-08/README.md @@ -1,11 +1,8 @@ -# Chapter 8: Structuring Projects +# Chapter 8: The Superbuild Pattern -- [Defining a macro with named arguments](recipe-01/README.md) -- [Splitting CMake sources into modules](recipe-02/README.md) -- [Function to test and set compiler flags](recipe-03/README.md) -- [Defining a function or macro with named arguments](recipe-04/README.md) -- [Redefining functions and macros](recipe-05/README.md) -- [Deprecating functions, macros, and variables](recipe-06/README.md) -- [Limiting scope with add_subdirectory](recipe-07/README.md) -- [Avoiding global variables using target_sources](recipe-08/README.md) -- [Organizing Fortran projects](recipe-09/README.md) +- [Using the superbuild pattern](recipe-01/README.md) +- [Managing dependencies with a superbuild I. The Boost libraries](recipe-02/README.md) +- [Managing dependencies with a superbuild II. The FFTW library](recipe-03/README.md) +- [Managing dependencies with a superbuild III. The Eigen library](recipe-04/README.md) +- [Managing dependencies with a superbuild IV. The HDF5 library](recipe-05/README.md) +- [Managing your project as a superbuild](recipe-06/README.md) diff --git a/chapter-08/recipe-01/README.md b/chapter-08/recipe-01/README.md index 4bc3299dc..c7a071203 100644 --- a/chapter-08/recipe-01/README.md +++ b/chapter-08/recipe-01/README.md @@ -1,4 +1,4 @@ -# Defining a macro with named arguments +# Using the superbuild pattern Abstract to be written ... diff --git a/chapter-08/recipe-01/cxx-example/CMakeLists.txt b/chapter-08/recipe-01/cxx-example/CMakeLists.txt index e8222b1ad..bd33464b9 100644 --- a/chapter-08/recipe-01/cxx-example/CMakeLists.txt +++ b/chapter-08/recipe-01/cxx-example/CMakeLists.txt @@ -6,13 +6,19 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -include(GNUInstallDirs) - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) - -add_subdirectory(src) - -enable_testing() -add_subdirectory(tests) +include(ExternalProject) +ExternalProject_Add(${PROJECT_NAME}_core + SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/src + CMAKE_ARGS + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} + -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} + CMAKE_CACHE_ARGS + -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} + BUILD_ALWAYS + 1 + INSTALL_COMMAND + "" + ) diff --git a/chapter-08/recipe-01/cxx-example/src/CMakeLists.txt b/chapter-08/recipe-01/cxx-example/src/CMakeLists.txt index 8f08cc44b..6498e13c0 100644 --- a/chapter-08/recipe-01/cxx-example/src/CMakeLists.txt +++ b/chapter-08/recipe-01/cxx-example/src/CMakeLists.txt @@ -1,6 +1,5 @@ -set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -add_library(sum_integers sum_integers.cpp) +project(recipe-01_core LANGUAGES CXX) -add_executable(sum_up main.cpp) -target_link_libraries(sum_up sum_integers) +add_executable(hello-world hello-world.cpp) diff --git a/chapter-07/recipe-01/cxx-example/src/hello-world.cpp b/chapter-08/recipe-01/cxx-example/src/hello-world.cpp similarity index 100% rename from chapter-07/recipe-01/cxx-example/src/hello-world.cpp rename to chapter-08/recipe-01/cxx-example/src/hello-world.cpp diff --git a/chapter-08/recipe-01/title.txt b/chapter-08/recipe-01/title.txt index 1f3132a19..3b58d88f6 100644 --- a/chapter-08/recipe-01/title.txt +++ b/chapter-08/recipe-01/title.txt @@ -1 +1 @@ -Defining a macro with named arguments +Using the superbuild pattern diff --git a/chapter-08/recipe-02/README.md b/chapter-08/recipe-02/README.md index c509f5c5a..a2011cf16 100644 --- a/chapter-08/recipe-02/README.md +++ b/chapter-08/recipe-02/README.md @@ -1,5 +1,5 @@ -# Splitting CMake sources into modules +# Managing dependencies with a superbuild I. The Boost libraries Abstract to be written ... -- [example](example/) +- [cxx-example](cxx-example/) diff --git a/chapter-07/recipe-02/cxx-example/CMakeLists.txt b/chapter-08/recipe-02/cxx-example/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-02/cxx-example/CMakeLists.txt rename to chapter-08/recipe-02/cxx-example/CMakeLists.txt diff --git a/chapter-07/recipe-02/cxx-example/external/upstream/CMakeLists.txt b/chapter-08/recipe-02/cxx-example/external/upstream/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-02/cxx-example/external/upstream/CMakeLists.txt rename to chapter-08/recipe-02/cxx-example/external/upstream/CMakeLists.txt diff --git a/chapter-07/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt b/chapter-08/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt rename to chapter-08/recipe-02/cxx-example/external/upstream/boost/CMakeLists.txt diff --git a/chapter-07/recipe-02/cxx-example/src/CMakeLists.txt b/chapter-08/recipe-02/cxx-example/src/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-02/cxx-example/src/CMakeLists.txt rename to chapter-08/recipe-02/cxx-example/src/CMakeLists.txt diff --git a/chapter-07/recipe-02/cxx-example/src/path-info.cpp b/chapter-08/recipe-02/cxx-example/src/path-info.cpp similarity index 100% rename from chapter-07/recipe-02/cxx-example/src/path-info.cpp rename to chapter-08/recipe-02/cxx-example/src/path-info.cpp diff --git a/chapter-08/recipe-02/title.txt b/chapter-08/recipe-02/title.txt index fcec1d8d1..befbc9f90 100644 --- a/chapter-08/recipe-02/title.txt +++ b/chapter-08/recipe-02/title.txt @@ -1 +1 @@ -Splitting CMake sources into modules +Managing dependencies with a superbuild I. The Boost libraries diff --git a/chapter-08/recipe-03/README.md b/chapter-08/recipe-03/README.md index acfe9daad..d21282d56 100644 --- a/chapter-08/recipe-03/README.md +++ b/chapter-08/recipe-03/README.md @@ -1,5 +1,5 @@ -# Function to test and set compiler flags +# Managing dependencies with a superbuild II. The FFTW library Abstract to be written ... -- [example](example/) +- [c-example](c-example/) diff --git a/chapter-07/recipe-03/c-example/CMakeLists.txt b/chapter-08/recipe-03/c-example/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-03/c-example/CMakeLists.txt rename to chapter-08/recipe-03/c-example/CMakeLists.txt diff --git a/chapter-07/recipe-03/c-example/external/upstream/CMakeLists.txt b/chapter-08/recipe-03/c-example/external/upstream/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-03/c-example/external/upstream/CMakeLists.txt rename to chapter-08/recipe-03/c-example/external/upstream/CMakeLists.txt diff --git a/chapter-07/recipe-03/c-example/external/upstream/fftw3/CMakeLists.txt b/chapter-08/recipe-03/c-example/external/upstream/fftw3/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-03/c-example/external/upstream/fftw3/CMakeLists.txt rename to chapter-08/recipe-03/c-example/external/upstream/fftw3/CMakeLists.txt diff --git a/chapter-07/recipe-03/c-example/src/CMakeLists.txt b/chapter-08/recipe-03/c-example/src/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-03/c-example/src/CMakeLists.txt rename to chapter-08/recipe-03/c-example/src/CMakeLists.txt diff --git a/chapter-07/recipe-03/c-example/src/fftw_example.c b/chapter-08/recipe-03/c-example/src/fftw_example.c similarity index 100% rename from chapter-07/recipe-03/c-example/src/fftw_example.c rename to chapter-08/recipe-03/c-example/src/fftw_example.c diff --git a/chapter-08/recipe-03/title.txt b/chapter-08/recipe-03/title.txt index 41e922ab4..38d46d1e8 100644 --- a/chapter-08/recipe-03/title.txt +++ b/chapter-08/recipe-03/title.txt @@ -1 +1 @@ -Function to test and set compiler flags +Managing dependencies with a superbuild II. The FFTW library diff --git a/chapter-08/recipe-04/README.md b/chapter-08/recipe-04/README.md index 2b3cd4584..b1abd9e8f 100644 --- a/chapter-08/recipe-04/README.md +++ b/chapter-08/recipe-04/README.md @@ -1,5 +1,6 @@ -# Defining a function or macro with named arguments +# Managing dependencies with a superbuild III. The Eigen library Abstract to be written ... - [cxx-example](cxx-example/) +- [cxx-example-3.5](cxx-example-3.5/) diff --git a/chapter-07/recipe-04/cxx-example-3.5/CMakeLists.txt b/chapter-08/recipe-04/cxx-example-3.5/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-04/cxx-example-3.5/CMakeLists.txt rename to chapter-08/recipe-04/cxx-example-3.5/CMakeLists.txt diff --git a/chapter-07/recipe-04/cxx-example-3.5/external/upstream/CMakeLists.txt b/chapter-08/recipe-04/cxx-example-3.5/external/upstream/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-04/cxx-example-3.5/external/upstream/CMakeLists.txt rename to chapter-08/recipe-04/cxx-example-3.5/external/upstream/CMakeLists.txt diff --git a/chapter-07/recipe-04/cxx-example-3.5/external/upstream/eigen3/CMakeLists.txt b/chapter-08/recipe-04/cxx-example-3.5/external/upstream/eigen3/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-04/cxx-example-3.5/external/upstream/eigen3/CMakeLists.txt rename to chapter-08/recipe-04/cxx-example-3.5/external/upstream/eigen3/CMakeLists.txt diff --git a/chapter-07/recipe-04/cxx-example-3.5/menu.yml b/chapter-08/recipe-04/cxx-example-3.5/menu.yml similarity index 100% rename from chapter-07/recipe-04/cxx-example-3.5/menu.yml rename to chapter-08/recipe-04/cxx-example-3.5/menu.yml diff --git a/chapter-07/recipe-04/cxx-example-3.5/src/CMakeLists.txt b/chapter-08/recipe-04/cxx-example-3.5/src/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-04/cxx-example-3.5/src/CMakeLists.txt rename to chapter-08/recipe-04/cxx-example-3.5/src/CMakeLists.txt diff --git a/chapter-07/recipe-04/cxx-example-3.5/src/linear-algebra.cpp b/chapter-08/recipe-04/cxx-example-3.5/src/linear-algebra.cpp similarity index 100% rename from chapter-07/recipe-04/cxx-example-3.5/src/linear-algebra.cpp rename to chapter-08/recipe-04/cxx-example-3.5/src/linear-algebra.cpp diff --git a/chapter-08/recipe-04/cxx-example/CMakeLists.txt b/chapter-08/recipe-04/cxx-example/CMakeLists.txt index c1d4e87c1..6bcba9003 100644 --- a/chapter-08/recipe-04/cxx-example/CMakeLists.txt +++ b/chapter-08/recipe-04/cxx-example/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) project(recipe-04 LANGUAGES CXX) @@ -6,17 +6,25 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +add_subdirectory(external/upstream) -include(GNUInstallDirs) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) - -add_subdirectory(src) - -enable_testing() -add_subdirectory(tests) +include(ExternalProject) +ExternalProject_Add(${PROJECT_NAME}_core + DEPENDS + eigen3_external + SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/src + CMAKE_ARGS + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS} + -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED} + -DEigen3_DIR=${Eigen3_DIR} + CMAKE_CACHE_ARGS + -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} + -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} + BUILD_ALWAYS + 1 + INSTALL_COMMAND + "" + ) diff --git a/chapter-07/recipe-04/cxx-example/external/upstream/CMakeLists.txt b/chapter-08/recipe-04/cxx-example/external/upstream/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-04/cxx-example/external/upstream/CMakeLists.txt rename to chapter-08/recipe-04/cxx-example/external/upstream/CMakeLists.txt diff --git a/chapter-07/recipe-04/cxx-example/external/upstream/eigen3/CMakeLists.txt b/chapter-08/recipe-04/cxx-example/external/upstream/eigen3/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-04/cxx-example/external/upstream/eigen3/CMakeLists.txt rename to chapter-08/recipe-04/cxx-example/external/upstream/eigen3/CMakeLists.txt diff --git a/chapter-08/recipe-04/cxx-example/menu.yml b/chapter-08/recipe-04/cxx-example/menu.yml index 6c5ad3628..a1b2ac465 100644 --- a/chapter-08/recipe-04/cxx-example/menu.yml +++ b/chapter-08/recipe-04/cxx-example/menu.yml @@ -1,2 +1,5 @@ -targets: - - test +# OpenMP does not work with clang +travis-osx: + failing_generators: + - 'Unix Makefiles' + - 'Ninja' diff --git a/chapter-08/recipe-04/cxx-example/src/CMakeLists.txt b/chapter-08/recipe-04/cxx-example/src/CMakeLists.txt index 695defc6c..a1ee51fc7 100644 --- a/chapter-08/recipe-04/cxx-example/src/CMakeLists.txt +++ b/chapter-08/recipe-04/cxx-example/src/CMakeLists.txt @@ -1,8 +1,15 @@ -# adds current directory to INTERFACE_INCLUDE_DIRECTORIES -# for targets defined below -set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) -add_library(sum_integers sum_integers.cpp) +project(recipe-04_core LANGUAGES CXX) -add_executable(sum_up main.cpp) -target_link_libraries(sum_up sum_integers) +find_package(OpenMP REQUIRED) + +find_package(Eigen3 3.3.4 REQUIRED CONFIG) +message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR} (found version ${EIGEN3_VERSION_STRING})") + +add_executable(linear-algebra linear-algebra.cpp) +target_link_libraries(linear-algebra + PUBLIC + Eigen3::Eigen + OpenMP::OpenMP_CXX + ) diff --git a/chapter-07/recipe-04/cxx-example/src/linear-algebra.cpp b/chapter-08/recipe-04/cxx-example/src/linear-algebra.cpp similarity index 100% rename from chapter-07/recipe-04/cxx-example/src/linear-algebra.cpp rename to chapter-08/recipe-04/cxx-example/src/linear-algebra.cpp diff --git a/chapter-08/recipe-04/title.txt b/chapter-08/recipe-04/title.txt index 0db2b2bea..f95176a18 100644 --- a/chapter-08/recipe-04/title.txt +++ b/chapter-08/recipe-04/title.txt @@ -1 +1 @@ -Defining a function or macro with named arguments +Managing dependencies with a superbuild III. The Eigen library diff --git a/chapter-08/recipe-05/README.md b/chapter-08/recipe-05/README.md index 64b238cb5..bd65595cf 100644 --- a/chapter-08/recipe-05/README.md +++ b/chapter-08/recipe-05/README.md @@ -1,5 +1,5 @@ -# Redefining functions and macros +# Managing dependencies with a superbuild IV. The HDF5 library Abstract to be written ... -- [example](example/) +- [fortran-example](fortran-example/) diff --git a/chapter-07/recipe-05/fortran-example/CMakeLists.txt b/chapter-08/recipe-05/fortran-example/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-05/fortran-example/CMakeLists.txt rename to chapter-08/recipe-05/fortran-example/CMakeLists.txt diff --git a/chapter-07/recipe-05/fortran-example/external/upstream/CMakeLists.txt b/chapter-08/recipe-05/fortran-example/external/upstream/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-05/fortran-example/external/upstream/CMakeLists.txt rename to chapter-08/recipe-05/fortran-example/external/upstream/CMakeLists.txt diff --git a/chapter-07/recipe-05/fortran-example/external/upstream/hdf5/CMakeLists.txt b/chapter-08/recipe-05/fortran-example/external/upstream/hdf5/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-05/fortran-example/external/upstream/hdf5/CMakeLists.txt rename to chapter-08/recipe-05/fortran-example/external/upstream/hdf5/CMakeLists.txt diff --git a/chapter-07/recipe-05/fortran-example/external/upstream/hdf5/test_hdf5_has_fortran2003.f90 b/chapter-08/recipe-05/fortran-example/external/upstream/hdf5/test_hdf5_has_fortran2003.f90 similarity index 100% rename from chapter-07/recipe-05/fortran-example/external/upstream/hdf5/test_hdf5_has_fortran2003.f90 rename to chapter-08/recipe-05/fortran-example/external/upstream/hdf5/test_hdf5_has_fortran2003.f90 diff --git a/chapter-07/recipe-05/fortran-example/menu.yml b/chapter-08/recipe-05/fortran-example/menu.yml similarity index 100% rename from chapter-07/recipe-05/fortran-example/menu.yml rename to chapter-08/recipe-05/fortran-example/menu.yml diff --git a/chapter-07/recipe-05/fortran-example/src/CMakeLists.txt b/chapter-08/recipe-05/fortran-example/src/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-05/fortran-example/src/CMakeLists.txt rename to chapter-08/recipe-05/fortran-example/src/CMakeLists.txt diff --git a/chapter-07/recipe-05/fortran-example/src/compound_fortran2003.f90 b/chapter-08/recipe-05/fortran-example/src/compound_fortran2003.f90 similarity index 100% rename from chapter-07/recipe-05/fortran-example/src/compound_fortran2003.f90 rename to chapter-08/recipe-05/fortran-example/src/compound_fortran2003.f90 diff --git a/chapter-07/recipe-05/fortran-example/src/test_hdf5_has_fortran2003.f90 b/chapter-08/recipe-05/fortran-example/src/test_hdf5_has_fortran2003.f90 similarity index 100% rename from chapter-07/recipe-05/fortran-example/src/test_hdf5_has_fortran2003.f90 rename to chapter-08/recipe-05/fortran-example/src/test_hdf5_has_fortran2003.f90 diff --git a/chapter-08/recipe-05/title.txt b/chapter-08/recipe-05/title.txt index a2abc9393..18c480e81 100644 --- a/chapter-08/recipe-05/title.txt +++ b/chapter-08/recipe-05/title.txt @@ -1 +1 @@ -Redefining functions and macros +Managing dependencies with a superbuild IV. The HDF5 library diff --git a/chapter-08/recipe-06/README.md b/chapter-08/recipe-06/README.md index 884ab5482..2afbe272c 100644 --- a/chapter-08/recipe-06/README.md +++ b/chapter-08/recipe-06/README.md @@ -1,5 +1,5 @@ -# Deprecating functions, macros, and variables +# Managing your project as a superbuild Abstract to be written ... -- [example](example/) +- [cxx-example](cxx-example/) diff --git a/chapter-07/recipe-06/cxx-example/CMakeLists.txt b/chapter-08/recipe-06/cxx-example/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-06/cxx-example/CMakeLists.txt rename to chapter-08/recipe-06/cxx-example/CMakeLists.txt diff --git a/chapter-07/recipe-06/cxx-example/external/upstream/CMakeLists.txt b/chapter-08/recipe-06/cxx-example/external/upstream/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-06/cxx-example/external/upstream/CMakeLists.txt rename to chapter-08/recipe-06/cxx-example/external/upstream/CMakeLists.txt diff --git a/chapter-07/recipe-06/cxx-example/external/upstream/message/CMakeLists.txt b/chapter-08/recipe-06/cxx-example/external/upstream/message/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-06/cxx-example/external/upstream/message/CMakeLists.txt rename to chapter-08/recipe-06/cxx-example/external/upstream/message/CMakeLists.txt diff --git a/chapter-07/recipe-06/cxx-example/src/CMakeLists.txt b/chapter-08/recipe-06/cxx-example/src/CMakeLists.txt similarity index 100% rename from chapter-07/recipe-06/cxx-example/src/CMakeLists.txt rename to chapter-08/recipe-06/cxx-example/src/CMakeLists.txt diff --git a/chapter-07/recipe-06/cxx-example/src/use_message.cpp b/chapter-08/recipe-06/cxx-example/src/use_message.cpp similarity index 100% rename from chapter-07/recipe-06/cxx-example/src/use_message.cpp rename to chapter-08/recipe-06/cxx-example/src/use_message.cpp diff --git a/chapter-08/recipe-06/title.txt b/chapter-08/recipe-06/title.txt index 4efe861c6..16ea95af7 100644 --- a/chapter-08/recipe-06/title.txt +++ b/chapter-08/recipe-06/title.txt @@ -1 +1 @@ -Deprecating functions, macros, and variables +Managing your project as a superbuild diff --git a/chapter-08/title.txt b/chapter-08/title.txt index fe06cb162..7049ced78 100644 --- a/chapter-08/title.txt +++ b/chapter-08/title.txt @@ -1 +1 @@ -Structuring Projects +The Superbuild Pattern