An open API service indexing awesome lists of open source software.

https://github.com/horance-liu/ccm.cmake


https://github.com/horance-liu/ccm.cmake

Last synced: 14 days ago
JSON representation

Awesome Lists containing this project

README

        

# ccm.cmake: c/c++ module utilities in cmake

**ccm.cmake** it is a simple dsl likes bazel for c/c++ target in cmake.

## Outline

### cc_library

```cmake
cc_library(
NAME name
[NAMESPACE namespace]
[ENABLE_INSTALL]
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
)
```

The `PUBLIC, PRIVATE and INTERFACE` prefix(default is PRIVATE in order to hide detals for implement with best effort) can be used to specify both the link dependencies and the link interface in one command. Libraries and targets following PUBLIC are linked to, and are made part of the link interface. Libraries and targets following PRIVATE are linked to, but are not made part of the link interface. Libraries following INTERFACE are appended to the link interface and are not used for linking .

### cc_binary

```cmake
cc_binary(
NAME name
[NAMESPACE namespace]
[ENABLE_INSTALL]
[ENABLE_TEST]
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
)
```

The `PUBLIC, PRIVATE and INTERFACE` prefix(default is PRIVATE) can be used to specify both the link dependencies and the link interface in one command. Libraries and targets following PUBLIC are linked to, and are made part of the link interface. Libraries and targets following PRIVATE are linked to, but are not made part of the link interface. Libraries following INTERFACE are appended to the link interface and are not used for linking .

### cc_test

```cmake
cc_test(
NAME name
[NAMESPACE namespace]
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
[ ...]...
)
```

The `PUBLIC, PRIVATE and INTERFACE` prefix(default is PRIVATE) can be used to specify both the link dependencies and the link interface in one command. Libraries and targets following PUBLIC are linked to, and are made part of the link interface. Libraries and targets following PRIVATE are linked to, but are not made part of the link interface. Libraries following INTERFACE are appended to the link interface and are not used for linking .

### cc_flink

```cmake
cc_flink(
...
[ ...]...
)
```

The `PUBLIC, PRIVATE and INTERFACE` keywords can be used to specify both the link dependencies and the link interface in one command. Libraries and targets following PUBLIC are linked to, and are made part of the link interface. Libraries and targets following PRIVATE are linked to, but are not made part of the link interface. Libraries following INTERFACE are appended to the link interface and are not used for linking .

### Namespace

```
set(CCM_NAMESPACE )
```

Simplistically, after setting `CCM_NAMESPACE` variable will add namespace to targets created in the current directory scope and below.

Dependence `:dep_name` with prefix `:` for `DEPS|PRIVATE_DEPS|PUBLIC_DEPS|INTERFACE_DEPS` in the same namespace, the framework will prepend full name for dependency; otherwise must define full `namespace::dep_name` for dependence explicitly.

### TODO

- ENABLE_INSTALL:
- TEST_ONLY

## Example

- [ccm.cmake example](example)