Slightly improve cmkr init #24
parent
cc2b984aa5
commit
6a825e15a0
@ -1,45 +1,100 @@
|
||||
#pragma once
|
||||
|
||||
static const char *hello_world = &R"lit(
|
||||
static const char *cpp_executable = &R"lit(
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
int %s() {
|
||||
std::cout << "Hello World!\n";
|
||||
return 0;
|
||||
int main() {
|
||||
std::cout << "Hello from cmkr!\n";
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
)lit"[1]; // skip initial newline
|
||||
|
||||
static const char *cmake_toml = &R"lit(
|
||||
[cmake]
|
||||
version = "3.15"
|
||||
# subdirs = []
|
||||
# build-dir = ""
|
||||
# cpp-flags = []
|
||||
# c-flags = []
|
||||
# link-flags = []
|
||||
# generator = ""
|
||||
# arguments = []
|
||||
static const char *cpp_library = &R"lit(
|
||||
#include <@name/@name.hpp>
|
||||
|
||||
#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]
|
||||
name = "%s"
|
||||
version = "0.1.0"
|
||||
name = "@name"
|
||||
|
||||
[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]
|
||||
type = "%s"
|
||||
sources = ["src/*.cpp"]
|
||||
[target.@name]
|
||||
type = "interface"
|
||||
include-directories = ["include"]
|
||||
# alias = ""
|
||||
# compile-features = []
|
||||
# compile-definitions = []
|
||||
# link-libraries = []
|
||||
|
||||
[[install]]
|
||||
%s = ["%s"]
|
||||
destination = "${CMAKE_INSTALL_PREFIX}/%s"
|
||||
compile-features = ["cxx_std_11"]
|
||||
)lit"[1]; // skip initial newline
|
||||
|
||||
static const char *toml_migration = &R"lit(
|
||||
# Reference: https://build-cpp.github.io/cmkr/cmake-toml
|
||||
[project]
|
||||
name = "@name"
|
||||
|
||||
# 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
|
||||
|
Loading…
Reference in new issue