Skip to content

Commit 520d37e

Browse files
committed
cmake: myci
1 parent 202ab09 commit 520d37e

3 files changed

Lines changed: 26 additions & 64 deletions

File tree

build/cmake/CMakeLists.txt

Lines changed: 20 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,29 @@
1-
cmake_minimum_required(VERSION 3.10)
2-
3-
include(GNUInstallDirs)
1+
cmake_minimum_required(VERSION 3.20)
42

53
set(name tml)
6-
74
project(${name})
85

9-
# ============================
10-
# = find dependency packages =
11-
12-
find_package(utki CONFIG REQUIRED)
13-
find_package(papki CONFIG REQUIRED)
14-
find_package(ZLIB REQUIRED)
15-
16-
# ============================
17-
18-
file(GLOB_RECURSE srcs "../../src/${name}/*.cpp")
19-
20-
add_library(
21-
${name}
22-
STATIC
23-
${srcs}
24-
)
25-
26-
target_compile_features(${name} PUBLIC cxx_std_17)
27-
set_target_properties(${name} PROPERTIES CXX_STANDARD_REQUIRED ON)
28-
set_target_properties(${name} PROPERTIES CXX_EXTENSIONS OFF)
29-
30-
target_include_directories(
31-
${name}
32-
INTERFACE
33-
$<BUILD_INTERFACE:>
34-
$<INSTALL_INTERFACE:include>
35-
)
6+
# !!! find_package must go after project() declaration !!!
7+
# Otherwise VCPKG does not set the CMAKE_PREFIX_PATH to find packages.
8+
find_package(myci CONFIG REQUIRED)
369

37-
target_link_libraries(
38-
${name}
39-
PUBLIC
40-
utki::utki
41-
papki::papki
42-
)
43-
44-
# install library header files preserving directory hierarchy
45-
install(
10+
set(srcs)
11+
myci_add_source_files(srcs
4612
DIRECTORY
47-
"${CMAKE_CURRENT_SOURCE_DIR}/../../src/${name}"
48-
DESTINATION
49-
"${CMAKE_INSTALL_INCLUDEDIR}"
50-
FILES_MATCHING PATTERN
51-
"*.hpp"
52-
)
53-
54-
install(
55-
TARGETS
56-
${name}
57-
EXPORT # generate cmake configs
58-
${name}-config
13+
../../src/${name}
14+
RECURSIVE
5915
)
6016

61-
# install cmake configs
62-
install(
63-
EXPORT
64-
${name}-config
65-
FILE
66-
${name}-config.cmake
67-
DESTINATION
68-
${CMAKE_INSTALL_DATAROOTDIR}/${name}
69-
NAMESPACE
70-
${name}::
17+
myci_declare_library(${name}
18+
SOURCES
19+
${srcs}
20+
PUBLIC_INCLUDE_DIRECTORIES
21+
../../src
22+
INSTALL_INCLUDE_DIRECTORIES
23+
../../src/${name}
24+
DEPENDENCIES
25+
utki
26+
papki
27+
EXTERNAL_DEPENDENCIES
28+
ZLIB
7129
)

build/vcpkg/test/vcpkg-configuration.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
{
99
"kind": "git",
1010
"repository": "https://github.com/cppfw/vcpkg-repo/",
11-
"baseline": "174a50e7c8fe5bbbd7408026382247920b648611",
11+
"baseline": "1e060074751728c83b8e354169c2ff9b0a43c77f",
1212
"reference": "main",
13-
"packages": [ "utki", "papki" ]
13+
"packages": [ "myci", "utki", "papki" ]
1414
}
1515
],
1616
"overlay-ports": [

build/vcpkg/vcpkg.json.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"name" : "vcpkg-cmake-config",
1414
"host" : true
1515
},
16+
{
17+
"name" : "myci",
18+
"host" : true
19+
},
1620
"utki",
1721
"papki"
1822
]

0 commit comments

Comments
 (0)