Init
This commit is contained in:
commit
84844eeab2
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build
|
19
CMakeLists.txt
Normal file
19
CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(Hello VERSION 1.0)
|
||||
|
||||
# add a lib
|
||||
add_subdirectory(alib)
|
||||
|
||||
add_executable(Hello main.c)
|
||||
|
||||
target_link_libraries(Hello PUBLIC alib)
|
||||
|
||||
# Version number thing
|
||||
configure_file(config.h.in config.h)
|
||||
target_include_directories(Hello PUBLIC
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
install(TARGETS Hello DESTINATION bin)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/config.h DESTINATION include)
|
23
CMakePresets.json
Normal file
23
CMakePresets.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"version": 2,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 10,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"displayName": "Default Config",
|
||||
"description": "Default build using Ninja generator",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/default"
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default"
|
||||
}
|
||||
]
|
||||
}
|
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# build
|
||||
|
||||
Use preset from `CMakePresets.json`
|
||||
|
||||
cmake -S . --preset=default
|
||||
|
||||
And then build
|
||||
|
||||
cmake --build build/default
|
7
alib/CMakeLists.txt
Normal file
7
alib/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
add_library(alib calc.c)
|
||||
target_include_directories(alib
|
||||
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
install(TARGETS alib DESTINATION lib)
|
||||
install(FILES calc.h DESTINATION include)
|
5
alib/calc.c
Normal file
5
alib/calc.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include "calc.h"
|
||||
|
||||
int docalc() {
|
||||
return 2;
|
||||
}
|
1
alib/calc.h
Normal file
1
alib/calc.h
Normal file
@ -0,0 +1 @@
|
||||
int docalc();
|
3
config.h.in
Normal file
3
config.h.in
Normal file
@ -0,0 +1,3 @@
|
||||
// the configured options and settings for Hello
|
||||
#define Hello_VERSION_MAJOR @Hello_VERSION_MAJOR@
|
||||
#define Hello_VERSION_MINOR @Hello_VERSION_MINOR@
|
Loading…
Reference in New Issue
Block a user