initial commit
This commit is contained in:
commit
d349796363
4 changed files with 62 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
build
|
||||
17
CMakeLists.txt
Normal file
17
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(xo_macros VERSION 1.0)
|
||||
|
||||
# if any are useful for this project..
|
||||
#include (cmake/foo.cmake)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# cmake export
|
||||
|
||||
set(XO_PROJECT_NAME xo_macros)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"cmake/xo_cxx.cmake"
|
||||
DESTINATION share/cmake/${XO_PROJECT_NAME}
|
||||
)
|
||||
21
README.md
Normal file
21
README.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# XO cmake modules
|
||||
|
||||
Collects cmake macros to be shared across XO projects (e.g. indentlog, reflect, kalman, ..)
|
||||
|
||||
## Features
|
||||
|
||||
- support for both manyrepo and monorepo projects
|
||||
- support for generating cmake `xxxConfig.cmake` files, so cmake `find_package()` works reliably
|
||||
|
||||
## Example
|
||||
|
||||
In some XO project `foo`:
|
||||
```
|
||||
$ cd build
|
||||
$ cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake ..
|
||||
```
|
||||
|
||||
then in `foo/CMakeLists.txt`:
|
||||
```
|
||||
include(xo_macros/xo_cxx)
|
||||
```
|
||||
23
cmake/xo_cxx.cmake
Normal file
23
cmake/xo_cxx.cmake
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
set(XO_STANDARD_COMPILE_OPTIONS -Werror -Wall -Wextra)
|
||||
set(XO_COMPILE_OPTIONS ${XO_STANDARD_COMPILE_OPTIONS})
|
||||
|
||||
macro(xo_copmile_options target)
|
||||
target_copmile_options(${target} PRIVATE ${XO_COMPILE_OPTIONS})
|
||||
endmacro()
|
||||
|
||||
# dependency on an xo library (including header-only libraries)
|
||||
# e.g. indentlog
|
||||
#
|
||||
# An xo package foo works with cmake
|
||||
# find_package(foo)
|
||||
# by providing plugin .cmake files in
|
||||
# ${PREFIX}/lib/cmake/foo/fooConfig.cmake
|
||||
# ${PREFIX}/lib/cmake/foo/fooConfigVersion.cmake
|
||||
# ${PREFIX}/lib/cmake/foo/fooTargets.cmake
|
||||
#
|
||||
# dep: name of required dependency, e.g. indentlog
|
||||
#
|
||||
macro(xo_internal_dependency target dep)
|
||||
find_pacakge(${dep} CONFIG REQUIRED)
|
||||
target_link_libraries(${target} PUBLIC ${dep})
|
||||
endmacro()
|
||||
Loading…
Add table
Add a link
Reference in a new issue