Skip to content

Commit

Permalink
Address comments from editor and reviewer
Browse files Browse the repository at this point in the history
- Fix naming of recipe 5 and 6 to reflect the one used in the text
- Text and source code are in sync
  • Loading branch information
robertodr committed May 22, 2018
1 parent db1c5b0 commit 6fedc0f
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 56 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
- [Switching Generators](chapter-01/recipe-02/README.md)
- [Building and Linking Static and Shared Libraries](chapter-01/recipe-03/README.md)
- [Controlling Compilation with Conditionals](chapter-01/recipe-04/README.md)
- [How to Present Options to the User](chapter-01/recipe-05/README.md)
- [How to Specify the Compiler](chapter-01/recipe-06/README.md)
- [Presenting Options to the User](chapter-01/recipe-05/README.md)
- [Specifying the Compiler](chapter-01/recipe-06/README.md)
- [Switching the Build Type](chapter-01/recipe-07/README.md)
- [Controlling Compiler Flags](chapter-01/recipe-08/README.md)
- [Setting the Standard for the Language](chapter-01/recipe-09/README.md)
Expand Down
4 changes: 2 additions & 2 deletions chapter-01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
- [Switching Generators](recipe-02/README.md)
- [Building and Linking Static and Shared Libraries](recipe-03/README.md)
- [Controlling Compilation with Conditionals](recipe-04/README.md)
- [How to Present Options to the User](recipe-05/README.md)
- [How to Specify the Compiler](recipe-06/README.md)
- [Presenting Options to the User](recipe-05/README.md)
- [Specifying the Compiler](recipe-06/README.md)
- [Switching the Build Type](recipe-07/README.md)
- [Controlling Compiler Flags](recipe-08/README.md)
- [Setting the Standard for the Language](recipe-09/README.md)
Expand Down
7 changes: 5 additions & 2 deletions chapter-01/recipe-03/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(recipe-03 LANGUAGES CXX)

# generate a library from sources
set(_sources Message.hpp Message.cpp)
add_library(message STATIC ${_sources})
add_library(message
STATIC
Message.hpp
Message.cpp
)

add_executable(hello-world hello-world.cpp)

Expand Down
7 changes: 5 additions & 2 deletions chapter-01/recipe-03/cxx-objlib-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(recipe-03 LANGUAGES CXX)

# generate an object library from sources
set(_sources Message.hpp Message.cpp)
add_library(message-objs OBJECT ${_sources})
add_library(message-objs
OBJECT
Message.hpp
Message.cpp
)
# This is only needed for older compilers, but doesn't hurt either to have it
set_target_properties(message-objs PROPERTIES POSITION_INDEPENDENT_CODE 1)

Expand Down
2 changes: 1 addition & 1 deletion chapter-01/recipe-04/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(recipe-04 LANGUAGES CXX)

# list sources
set(_sources Message.hpp Message.cpp)
list(APPEND _sources Message.hpp Message.cpp)

# introduce a toggle for using a library
set(USE_LIBRARY OFF)
Expand Down
2 changes: 1 addition & 1 deletion chapter-01/recipe-05/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Present Options to the User
# Presenting Options to the User

Abstract to be written ...

Expand Down
2 changes: 1 addition & 1 deletion chapter-01/recipe-05/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cmake_dependent_option(MAKE_SHARED_LIBRARY "Compile sources into a shared librar
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# list sources
set(_sources Message.hpp Message.cpp)
list(APPEND _sources Message.hpp Message.cpp)

message(STATUS "Compile sources into a library? ${USE_LIBRARY}")

Expand Down
2 changes: 1 addition & 1 deletion chapter-01/recipe-05/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
How to Present Options to the User
Presenting Options to the User
2 changes: 1 addition & 1 deletion chapter-01/recipe-06/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Specify the Compiler
# Specifying the Compiler

Abstract to be written ...

Expand Down
2 changes: 1 addition & 1 deletion chapter-01/recipe-06/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
How to Specify the Compiler
Specifying the Compiler
19 changes: 9 additions & 10 deletions chapter-01/recipe-07/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ message("C++ compiler flags, release mode: ${CMAKE_CXX_FLAGS_RELEASE}")
message("C++ compiler flags, release with debug info mode: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message("C++ compiler flags, minimal release mode: ${CMAKE_CXX_FLAGS_MINSIZEREL}")

add_library(
geometry
add_library(geometry
STATIC
geometry_circle.cpp
geometry_circle.hpp
geometry_polygon.cpp
geometry_polygon.hpp
geometry_rhombus.cpp
geometry_rhombus.hpp
geometry_square.cpp
geometry_square.hpp
geometry_circle.cpp
geometry_circle.hpp
geometry_polygon.cpp
geometry_polygon.hpp
geometry_rhombus.cpp
geometry_rhombus.hpp
geometry_square.cpp
geometry_square.hpp
)

add_executable(compute-areas compute-areas.cpp)
Expand Down
21 changes: 9 additions & 12 deletions chapter-01/recipe-08/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@ project(recipe-08 LANGUAGES CXX)

message("C++ compiler flags: ${CMAKE_CXX_FLAGS}")

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

list(APPEND flags "-fPIC" "-Wall")
if(NOT WIN32)
list(APPEND flags "-Wextra" "-Wpedantic")
endif()

add_library(
geometry
add_library(geometry
STATIC
geometry_circle.cpp
geometry_circle.hpp
geometry_polygon.cpp
geometry_polygon.hpp
geometry_rhombus.cpp
geometry_rhombus.hpp
geometry_square.cpp
geometry_square.hpp
geometry_circle.cpp
geometry_circle.hpp
geometry_polygon.cpp
geometry_polygon.hpp
geometry_rhombus.cpp
geometry_rhombus.hpp
geometry_square.cpp
geometry_square.hpp
)

target_compile_options(geometry
Expand Down
17 changes: 9 additions & 8 deletions chapter-01/recipe-09/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ project(recipe-09 LANGUAGES CXX)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

add_library(animals SHARED
Animal.cpp
Animal.hpp
Cat.cpp
Cat.hpp
Dog.cpp
Dog.hpp
Factory.hpp
add_library(animals
SHARED
Animal.cpp
Animal.hpp
Cat.cpp
Cat.hpp
Dog.cpp
Dog.hpp
Factory.hpp
)
set_target_properties(animals
PROPERTIES
Expand Down
22 changes: 10 additions & 12 deletions chapter-01/recipe-10/cxx-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
# project name and language
project(recipe-10 LANGUAGES CXX)

add_executable(compute-areas compute-areas.cpp)

add_library(
geometry
add_library(geometry
STATIC
geometry_circle.cpp
geometry_circle.hpp
geometry_polygon.cpp
geometry_polygon.hpp
geometry_rhombus.cpp
geometry_rhombus.hpp
geometry_square.cpp
geometry_square.hpp
geometry_circle.cpp
geometry_circle.hpp
geometry_polygon.cpp
geometry_polygon.hpp
geometry_rhombus.cpp
geometry_rhombus.hpp
geometry_square.cpp
geometry_square.hpp
)

# we wish to compile the library with the optimization flag: -O3
Expand All @@ -42,4 +39,5 @@ foreach(_source ${sources_with_lower_optimization})
message(STATUS "Source ${_source} has the following extra COMPILE_FLAGS: ${_flags}")
endforeach()

add_executable(compute-areas compute-areas.cpp)
target_link_libraries(compute-areas geometry)

0 comments on commit 6fedc0f

Please sign in to comment.