Skip to content

Commit

Permalink
swap chapters 7 and 8
Browse files Browse the repository at this point in the history
  • Loading branch information
bast committed May 26, 2018
1 parent d03f92d commit 9c21ef7
Show file tree
Hide file tree
Showing 166 changed files with 168 additions and 168 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 10 additions & 7 deletions chapter-07/README.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion chapter-07/recipe-01/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Using the superbuild pattern
# Defining a macro with named arguments

Abstract to be written ...

Expand Down
26 changes: 10 additions & 16 deletions chapter-07/recipe-01/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
File renamed without changes.
7 changes: 4 additions & 3 deletions chapter-07/recipe-01/cxx-example/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion chapter-07/recipe-01/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Using the superbuild pattern
Defining a macro with named arguments
4 changes: 2 additions & 2 deletions chapter-07/recipe-02/README.md
Original file line number Diff line number Diff line change
@@ -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/)
File renamed without changes.
2 changes: 1 addition & 1 deletion chapter-07/recipe-02/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Managing dependencies with a superbuild I. The Boost libraries
Splitting CMake sources into modules
4 changes: 2 additions & 2 deletions chapter-07/recipe-03/README.md
Original file line number Diff line number Diff line change
@@ -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/)
File renamed without changes.
2 changes: 1 addition & 1 deletion chapter-07/recipe-03/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Managing dependencies with a superbuild II. The FFTW library
Function to test and set compiler flags
3 changes: 1 addition & 2 deletions chapter-07/recipe-04/README.md
Original file line number Diff line number Diff line change
@@ -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/)
36 changes: 14 additions & 22 deletions chapter-07/recipe-04/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(recipe-04 LANGUAGES CXX)

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)
7 changes: 2 additions & 5 deletions chapter-07/recipe-04/cxx-example/menu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# OpenMP does not work with clang
travis-osx:
failing_generators:
- 'Unix Makefiles'
- 'Ninja'
targets:
- test
19 changes: 6 additions & 13 deletions chapter-07/recipe-04/cxx-example/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion chapter-07/recipe-04/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Managing dependencies with a superbuild III. The Eigen library
Defining a function or macro with named arguments
4 changes: 2 additions & 2 deletions chapter-07/recipe-05/README.md
Original file line number Diff line number Diff line change
@@ -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/)
File renamed without changes.
2 changes: 1 addition & 1 deletion chapter-07/recipe-05/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Managing dependencies with a superbuild IV. The HDF5 library
Redefining functions and macros
4 changes: 2 additions & 2 deletions chapter-07/recipe-06/README.md
Original file line number Diff line number Diff line change
@@ -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/)
File renamed without changes.
2 changes: 1 addition & 1 deletion chapter-07/recipe-06/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Managing your project as a superbuild
Deprecating functions, macros, and variables
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion chapter-07/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The Superbuild Pattern
Structuring Projects
17 changes: 7 additions & 10 deletions chapter-08/README.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion chapter-08/recipe-01/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Defining a macro with named arguments
# Using the superbuild pattern

Abstract to be written ...

Expand Down
26 changes: 16 additions & 10 deletions chapter-08/recipe-01/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
""
)
7 changes: 3 additions & 4 deletions chapter-08/recipe-01/cxx-example/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion chapter-08/recipe-01/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Defining a macro with named arguments
Using the superbuild pattern
4 changes: 2 additions & 2 deletions chapter-08/recipe-02/README.md
Original file line number Diff line number Diff line change
@@ -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/)
2 changes: 1 addition & 1 deletion chapter-08/recipe-02/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Splitting CMake sources into modules
Managing dependencies with a superbuild I. The Boost libraries
4 changes: 2 additions & 2 deletions chapter-08/recipe-03/README.md
Original file line number Diff line number Diff line change
@@ -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/)
2 changes: 1 addition & 1 deletion chapter-08/recipe-03/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Function to test and set compiler flags
Managing dependencies with a superbuild II. The FFTW library
3 changes: 2 additions & 1 deletion chapter-08/recipe-04/README.md
Original file line number Diff line number Diff line change
@@ -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/)
36 changes: 22 additions & 14 deletions chapter-08/recipe-04/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)

project(recipe-04 LANGUAGES CXX)

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
""
)
Loading

0 comments on commit 9c21ef7

Please sign in to comment.