https://github.com/nicledomas/cmake
Cmake scripts for build c++ projects
https://github.com/nicledomas/cmake
build clang-tidy cmake cmake-scripts conan cpp unit-testing
Last synced: 6 months ago
JSON representation
Cmake scripts for build c++ projects
- Host: GitHub
- URL: https://github.com/nicledomas/cmake
- Owner: nicledomaS
- License: apache-2.0
- Created: 2020-09-25T21:12:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T12:24:10.000Z (about 3 years ago)
- Last Synced: 2024-07-30T17:51:21.671Z (over 1 year ago)
- Topics: build, clang-tidy, cmake, cmake-scripts, conan, cpp, unit-testing
- Language: CMake
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![License][license-image]][license-url]
# cmake
Cmake scripts for build c++ projects
## Flags
### `FIND_CONAN`
Find conanfile in project
### `FIND_MODULES`
Find modules in folder `modules`.
Default: `OFF`
Examle: `-DFIND_MODULES=ON`
### `FIND_TESTS`
Find tests in folder `tests`.
Default: `OFF`
Examle: `-DFIND_TESTS=ON`
### `ENABLE_TIDY`
Enable clang-tidy for code analysis.
Default: `OFF`
Examle: `-DENABLE_TIDY=ON`
## Struct project
```
\
|--CMakeList.txt
|--cmake
|--conanfile.txt
|--modules
| \
| |--Modules1--CMakeLists.txt
| |--Modules2--CMakeLists.txt
|
|--include
|--src
|--tests
\
|--googletests
|--test1--CMakeLists.txt
```
## Examples:
conanfile.txt
```
[requires]
toml11/3.7.0
[generators]
cmake_paths
cmake_find_package
[options]
```
Conan documentatio:
https://docs.conan.io/en/1.46/reference/generators.html
https://docs.conan.io/en/1.46/integrations/build_system/cmake.html
Executable
```cmake
project(TestApp)
include(cmake/make.cmake)
#TARGET - project name
#SOURCES - path to source
#THREADS - threads module to add project
#CONAN_MODULES - list of conan modules to add project
#BOOST - list of boost modules to add project
#MODULES - list of own modules to add project
#LIBS - list of external modules to add project
executable(${PROJECT_NAME}
SOURCES ""
THREADS
CONAN_MODULES toml11
BOOST system
MODULES Modules1 Modules2
LIBS ... ...)
```
Modules 1
```cmake
project(Modules1)
include(cmake/make.cmake)
static_library(${PROJECT_NAME}
SOURCES ""
THREADS
CONAN_MODULES ... ...
BOOST ... ...
MODULES ... ...
LIBS ... ...)
```
Modules 2
```cmake
project(Modules2)
include(cmake/make.cmake)
shared_library(${PROJECT_NAME}
SOURCES ""
THREADS
CONAN_MODULES ... ...
BOOST ... ...
MODULES ... ...
LIBS ... ...)
```
[license-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
[license-url]: LICENSE