parent
760b2a8511
commit
4b300df8d5
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
# Automatically generated from tests/cxx-standard/cmake.toml - DO NOT EDIT
|
||||||
|
layout: default
|
||||||
|
title: Changing C++ standard
|
||||||
|
permalink: /examples/cxx-standard
|
||||||
|
parent: Examples
|
||||||
|
nav_order: 5
|
||||||
|
---
|
||||||
|
|
||||||
|
# Changing C++ standard
|
||||||
|
|
||||||
|
Require a C++11 compiler for the target `example`.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[project]
|
||||||
|
name = "cxx-standard"
|
||||||
|
description = "Changing C++ standard"
|
||||||
|
|
||||||
|
[target.example]
|
||||||
|
type = "executable"
|
||||||
|
sources = ["src/main.cpp"]
|
||||||
|
compile-features = ["cxx_std_11"]
|
||||||
|
```
|
||||||
|
|
||||||
|
This is equivalent to CMake's [target_compile_features](https://cmake.org/cmake/help/latest/command/target_compile_features.html)`(example PRIVATE cxx_std_11)`. For more information on available C/C++ standards and features see [cmake-compile-features(7)](https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html).
|
||||||
|
|
||||||
|
<sup><sub>This page was automatically generated from [tests/cxx-standard/cmake.toml](https://github.com/build-cpp/cmkr/tree/main/tests/cxx-standard/cmake.toml).</sub></sup>
|
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
# Automatically generated from tests/globbing/cmake.toml - DO NOT EDIT
|
||||||
|
layout: default
|
||||||
|
title: Globbing sources
|
||||||
|
permalink: /examples/globbing
|
||||||
|
parent: Examples
|
||||||
|
nav_order: 6
|
||||||
|
---
|
||||||
|
|
||||||
|
# Globbing sources
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[project]
|
||||||
|
name = "globbing"
|
||||||
|
description = "Globbing sources"
|
||||||
|
|
||||||
|
# Recursively glob in the mylib/ folder
|
||||||
|
[target.mylib]
|
||||||
|
type = "static"
|
||||||
|
alias = "mylib::mylib"
|
||||||
|
sources = ["mylib/**.hpp", "mylib/**.cpp"]
|
||||||
|
include-directories = ["mylib/include"]
|
||||||
|
|
||||||
|
# Single-folder glob in example/src/
|
||||||
|
[target.example]
|
||||||
|
type = "executable"
|
||||||
|
sources = ["example/src/*.cpp"]
|
||||||
|
link-libraries = ["mylib::mylib"]
|
||||||
|
```
|
||||||
|
|
||||||
|
As you can see in the example above you can use `**.ext` to glob recursively and `*.ext` to glob non-recursively. This **does not** generate `file(GLOB ...)` commands, but instead globs when cmkr is run. Files are sorted to give deterministic results regardless of the platform used.
|
||||||
|
|
||||||
|
<sup><sub>This page was automatically generated from [tests/globbing/cmake.toml](https://github.com/build-cpp/cmkr/tree/main/tests/globbing/cmake.toml).</sub></sup>
|
@ -0,0 +1,12 @@
|
|||||||
|
# Require a C++11 compiler for the target `example`.
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "cxx-standard"
|
||||||
|
description = "Changing C++ standard"
|
||||||
|
|
||||||
|
[target.example]
|
||||||
|
type = "executable"
|
||||||
|
sources = ["src/main.cpp"]
|
||||||
|
compile-features = ["cxx_std_11"]
|
||||||
|
|
||||||
|
# This is equivalent to CMake's [target_compile_features](https://cmake.org/cmake/help/latest/command/target_compile_features.html)`(example PRIVATE cxx_std_11)`. For more information on available C/C++ standards and features see [cmake-compile-features(7)](https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html).
|
@ -0,0 +1,8 @@
|
|||||||
|
#include <cstdio>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
auto tpl = std::make_tuple(1, 2);
|
||||||
|
printf("Hello from C++11 %d\n", std::get<0>(tpl));
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
[project]
|
||||||
|
name = "globbing"
|
||||||
|
description = "Globbing sources"
|
||||||
|
|
||||||
|
# Recursively glob in the mylib/ folder
|
||||||
|
[target.mylib]
|
||||||
|
type = "static"
|
||||||
|
alias = "mylib::mylib"
|
||||||
|
sources = ["mylib/**.hpp", "mylib/**.cpp"]
|
||||||
|
include-directories = ["mylib/include"]
|
||||||
|
|
||||||
|
# Single-folder glob in example/src/
|
||||||
|
[target.example]
|
||||||
|
type = "executable"
|
||||||
|
sources = ["example/src/*.cpp"]
|
||||||
|
link-libraries = ["mylib::mylib"]
|
||||||
|
|
||||||
|
# As you can see in the example above you can use `**.ext` to glob recursively and `*.ext` to glob non-recursively. This **does not** generate `file(GLOB ...)` commands, but instead globs when cmkr is run. Files are sorted to give deterministic results regardless of the platform used.
|
@ -0,0 +1,7 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <mylib/mylib.hpp>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::cout << mylib::message() << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace mylib
|
||||||
|
{
|
||||||
|
std::string message();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
#include <mylib/mylib.hpp>
|
||||||
|
|
||||||
|
std::string mylib::message()
|
||||||
|
{
|
||||||
|
return "cmkr is awesome!";
|
||||||
|
}
|
Loading…
Reference in new issue