Squashed 'cmake/cable/' changes from 5fd6d89..caeabb3

caeabb3 CableBuildInfo: Specify gitinfo.txt byproduct
69a5abc CableBuildInfo: Remove broken debug logs
a5a1829 CableCompilerSettings: Enabled conversion warnings by default
0790aec README: Add section about git subtree
4056c71 Add the project name to every file
612d1b2 Add cxx11-c99 toolchain file

git-subtree-dir: cmake/cable
git-subtree-split: caeabb3a9f054f5c0b5076aa958968c42f7a5df4
This commit is contained in:
Paweł Bylica 2018-05-11 16:58:08 +02:00
parent ecd18a29e5
commit 6ee4682924
14 changed files with 50 additions and 17 deletions

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
@ -45,6 +46,7 @@ function(cable_add_buildinfo_library)
-DSOURCE_DIR=${PROJECT_SOURCE_DIR}
-DBINARY_DIR=${binary_dir}
-P ${cable_buildinfo_template_dir}/gitinfo.cmake
BYPRODUCTS ${binary_dir}/gitinfo.txt
)
add_custom_command(
@ -60,7 +62,6 @@ function(cable_add_buildinfo_library)
-DCOMPILER_ID=${CMAKE_CXX_COMPILER_ID}
-DCOMPILER_VERSION=${CMAKE_CXX_COMPILER_VERSION}
-DBUILD_TYPE=${build_type}
-DCABLE_DEBUG=${CABLE_DEBUG}
-P ${cable_buildinfo_template_dir}/buildinfo.cmake
DEPENDS
${cable_buildinfo_template_dir}/buildinfo.cmake

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -32,7 +32,7 @@ macro(cable_configure_compiler)
if(NOT PROJECT_IS_NESTED)
# Do this configuration only in the top project.
cmake_parse_arguments(cable "NO_STACK_PROTECTION" "" "" ${ARGN})
cmake_parse_arguments(cable "NO_CONVERSION_WARNINGS;NO_STACK_PROTECTION" "" "" ${ARGN})
if(cable_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "cable_configure_compiler: Uknown options: ${cable_UNPARSED_ARGUMENTS}")
@ -53,7 +53,12 @@ macro(cable_configure_compiler)
if(CABLE_COMPILER_GNULIKE)
# Enable basing warnings set and treat them as errors.
add_compile_options(-Wall -Wextra -Werror -pedantic)
add_compile_options(-pedantic -Werror -Wall -Wextra)
if(NOT cable_NO_CONVERSION_WARNINGS)
# Enable conversion warnings if not explicitly disabled.
add_compile_options(-Wconversion -Wsign-conversion)
endif()
# Allow unknown pragmas, we don't want to wrap them with #ifdefs.
add_compile_options(-Wno-unknown-pragmas)

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -7,7 +7,7 @@
Cable is a set of CMake modules and scripts containing common patterns used
in CMake-based C++ projects. The design goal is to be pragmatic rather than
generic so the number of provided options is minimal. The Cable modules are
independent so it is easy to use them individually.
independent and it is easy to use them individually.
## Table of Contents
@ -20,9 +20,22 @@ independent so it is easy to use them individually.
## Install
### As git subtree
Adding a dependency project as a [git subtree] is just a copy of the source code
done in a bit more systematic way.
If you are not familiar with managing dependencies with git subtree read the
[Git subtree: the alternative to Git submodule][git subtree tutorial].
```sh
git remote add cable https://github.com/ethereum/cable
git subtree add --prefix cmake/cable cable master --squash
```
### As git submodule
Include the Cable library as git submodule in your project. The suggested
Include the Cable library as [git submodule] in your project. The suggested
submodule location is `cmake/cable` relative to your project root directory.
```sh
@ -32,9 +45,9 @@ git submodule add https://github.com/ethereum/cable cmake/cable
## Usage
Cable contains the `bootstrap.cmake` file that initializes the library.
Start by including this file in your main `CMakeLists.txt` from Cable submodule
or any other location. The `bootstrap.cmake` must be included before
the `project()` command. After that, you can include and use other
Start by including this file in your main `CMakeLists.txt` from the Cable
submodule/subtree or any other location. The `bootstrap.cmake` must be included
before the `project()` command. After that, you can include and use other
Cable modules.
### Example
@ -61,7 +74,10 @@ Licensed under the [Apache License, Version 2.0].
[@chfast]: https://github.com/chfast
[Apache License, Version 2.0]: https://www.apache.org/licenses/LICENSE-2.0
[Apache License, Version 2.0]: LICENSE
[git submodule]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[git subtree]: https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt
[git subtree tutorial]: https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree
[standard readme]: https://github.com/RichardLitt/standard-readme
[readme style standard badge]: https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square

View File

@ -10,7 +10,7 @@
#
# This is internal variable automaticaly updated with external tools.
# Use CABLE_VERSION variable if you need this information.
set(version 0.1.7)
set(version 0.2.2)
# For conveniance, add the project CMake module dir to module path.
set(module_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

View File

@ -29,13 +29,6 @@ else()
set(GIT_DIRTY FALSE)
endif()
cable_debug("gitinfo: parsing '${GIT_INFO}':")
cable_debug(" version: ${GIT_LATEST_PROJECT_VERSION}")
cable_debug(" distance: ${GIT_LATEST_PROJECT_VERSION_DISTANCE}")
cable_debug(" commit: ${GIT_COMMIT_HASH}")
cable_debug(" dirty: ${GIT_DIRTY}")
if(GIT_COMMIT_HASH)
string(SUBSTRING ${GIT_COMMIT_HASH} 0 8 abbrev)
set(version_commit "+commit.${abbrev}")

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -0,0 +1,10 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_EXTENSIONS OFF)

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -1,2 +1,3 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.

View File

@ -1,3 +1,4 @@
# Cable: CMake Bootstrap Library.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.