forked from dev-cafe/cmake-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
166 changed files
with
168 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Using the superbuild pattern | ||
# Defining a macro with named arguments | ||
|
||
Abstract to be written ... | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Using the superbuild pattern | ||
Defining a macro with named arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Managing dependencies with a superbuild I. The Boost libraries | ||
Splitting CMake sources into modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Managing dependencies with a superbuild II. The FFTW library | ||
Function to test and set compiler flags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,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/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,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) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
# OpenMP does not work with clang | ||
travis-osx: | ||
failing_generators: | ||
- 'Unix Makefiles' | ||
- 'Ninja' | ||
targets: | ||
- test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,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) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Managing dependencies with a superbuild III. The Eigen library | ||
Defining a function or macro with named arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Managing dependencies with a superbuild IV. The HDF5 library | ||
Redefining functions and macros |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +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.
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.
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.
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.
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.
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.
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.
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.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
The Superbuild Pattern | ||
Structuring Projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Defining a macro with named arguments | ||
# Using the superbuild pattern | ||
|
||
Abstract to be written ... | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,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) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Defining a macro with named arguments | ||
Using the superbuild pattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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/) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Splitting CMake sources into modules | ||
Managing dependencies with a superbuild I. The Boost libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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/) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Function to test and set compiler flags | ||
Managing dependencies with a superbuild II. The FFTW library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,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/) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,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 | ||
"" | ||
) |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.