Slightly improve cmkr init #24
parent
cc2b984aa5
commit
6a825e15a0
@ -1,45 +1,100 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
static const char *hello_world = &R"lit(
|
static const char *cpp_executable = &R"lit(
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
int %s() {
|
int main() {
|
||||||
std::cout << "Hello World!\n";
|
std::cout << "Hello from cmkr!\n";
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
)lit"[1]; // skip initial newline
|
)lit"[1]; // skip initial newline
|
||||||
|
|
||||||
static const char *cmake_toml = &R"lit(
|
static const char *cpp_library = &R"lit(
|
||||||
[cmake]
|
#include <@name/@name.hpp>
|
||||||
version = "3.15"
|
|
||||||
# subdirs = []
|
|
||||||
# build-dir = ""
|
|
||||||
# cpp-flags = []
|
|
||||||
# c-flags = []
|
|
||||||
# link-flags = []
|
|
||||||
# generator = ""
|
|
||||||
# arguments = []
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace @name {
|
||||||
|
|
||||||
|
void hello() {
|
||||||
|
std::cout << "Hello from cmkr!\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace @name
|
||||||
|
)lit"[1]; // skip initial newline
|
||||||
|
|
||||||
|
static const char *hpp_library = &R"lit(
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace @name {
|
||||||
|
|
||||||
|
void hello();
|
||||||
|
|
||||||
|
} // namespace @name
|
||||||
|
)lit"[1]; // skip initial newline
|
||||||
|
|
||||||
|
static const char *hpp_interface = &R"lit(
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace @name {
|
||||||
|
|
||||||
|
inline void hello() {
|
||||||
|
std::cout << "Hello from cmkr!\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace @name
|
||||||
|
)lit"[1]; // skip initial newline
|
||||||
|
|
||||||
|
static const char *toml_executable = &R"lit(
|
||||||
|
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
|
||||||
[project]
|
[project]
|
||||||
name = "%s"
|
name = "@name"
|
||||||
version = "0.1.0"
|
|
||||||
|
[target.@name]
|
||||||
|
type = "executable"
|
||||||
|
sources = ["src/@name/main.cpp"]
|
||||||
|
compile-features = ["cxx_std_11"]
|
||||||
|
)lit"[1]; // skip initial newline
|
||||||
|
|
||||||
# [find-package]
|
static const char *toml_library = &R"lit(
|
||||||
|
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
|
||||||
|
[project]
|
||||||
|
name = "@name"
|
||||||
|
|
||||||
# [fetch-content]
|
[target.@name]
|
||||||
|
type = "@type"
|
||||||
|
sources = [
|
||||||
|
"src/@name/@name.cpp",
|
||||||
|
"include/@name/@name.hpp"
|
||||||
|
]
|
||||||
|
include-directories = ["include"]
|
||||||
|
compile-features = ["cxx_std_11"]
|
||||||
|
)lit"[1]; // skip initial newline
|
||||||
|
|
||||||
# [options]
|
static const char *toml_interface = &R"lit(
|
||||||
|
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
|
||||||
|
[project]
|
||||||
|
name = "@name"
|
||||||
|
|
||||||
[target.%s]
|
[target.@name]
|
||||||
type = "%s"
|
type = "interface"
|
||||||
sources = ["src/*.cpp"]
|
|
||||||
include-directories = ["include"]
|
include-directories = ["include"]
|
||||||
# alias = ""
|
compile-features = ["cxx_std_11"]
|
||||||
# compile-features = []
|
)lit"[1]; // skip initial newline
|
||||||
# compile-definitions = []
|
|
||||||
# link-libraries = []
|
static const char *toml_migration = &R"lit(
|
||||||
|
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
|
||||||
[[install]]
|
[project]
|
||||||
%s = ["%s"]
|
name = "@name"
|
||||||
destination = "${CMAKE_INSTALL_PREFIX}/%s"
|
|
||||||
|
# TODO: define a target for each of your executables/libraries like this:
|
||||||
|
#[target.@name]
|
||||||
|
#type = "executable"
|
||||||
|
#sources = ["src/@name/*.cpp", "include/@name/*.hpp"]
|
||||||
|
#include-directories = ["include"]
|
||||||
|
#compile-features = ["cxx_std_11"]
|
||||||
|
#link-libraries = ["other-targets"]
|
||||||
)lit"[1]; // skip initial newline
|
)lit"[1]; // skip initial newline
|
||||||
|
Loading…
Reference in new issue