aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/ztd-static-containers/fix-cmake.patch
blob: cef15e5a2e34ee5b6bacbe84d132badc8278a557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32371d4..22223ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,8 @@ project(ztd.static_containers
 	VERSION 0.5.0
 	DESCRIPTION "A library for a fixed-capacity vector."
 	LANGUAGES C CXX)
+include(CMakePackageConfigHelpers)
+include(GNUInstallDirs)
 
 if(ZTD_STATIC_CONTAINERS_READTHEDOCS)
 	# ReadTheDocs seems unable to handle the include at the project level: something must be going wrong?
@@ -113,10 +115,7 @@ option(ZTD_STATIC_CONTAINERS_BENCHMARKS "Enable build of benchmarks" OFF)
 
 # # Dependencies
 # ztd.idk
-FetchContent_Declare(ztd.idk
-	GIT_REPOSITORY https://github.com/soasis/idk.git
-	GIT_TAG main)
-FetchContent_MakeAvailable(ztd.idk)
+find_package(ztd.idk CONFIG REQUIRED)
 
 file(GLOB_RECURSE ztd.static_containers.sources
 	LIST_DIRECTORIES FALSE
@@ -126,7 +125,6 @@ file(GLOB_RECURSE ztd.static_containers.sources
 
 add_library(ztd.static_containers INTERFACE)
 add_library(ztd::static_containers ALIAS ztd.static_containers)
-target_sources(ztd.static_containers INTERFACE ${ztd.static_containers.sources})
 target_link_libraries(ztd.static_containers
 	INTERFACE
 	ztd::idk
@@ -155,6 +153,18 @@ export(TARGETS ztd.static_containers
 	FILE
 	"${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.static_containers/ztd.static_containers-targets.cmake")
 
+install(TARGETS ztd.static_containers
+	EXPORT ztd.static_containers-targets)
+install(EXPORT ztd.static_containers-targets
+  FILE ztd.static_containers-targets.cmake
+  DESTINATION share/ztd.static_containers
+)
+install(FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.static_containers/ztd.static_containers-config.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.static_containers/ztd.static_containers-config-version.cmake
+  DESTINATION share/ztd.static_containers
+)
+ 
 # # Benchmarks, Tests, Examples
 if(ZTD_STATIC_CONTAINERS_TESTS)
 	enable_testing()
diff --git a/cmake/ztd.static_containers-config.cmake.in b/cmake/ztd.static_containers-config.cmake.in
index f96ace2..94340c1 100644
--- a/cmake/ztd.static_containers-config.cmake.in
+++ b/cmake/ztd.static_containers-config.cmake.in
@@ -1,6 +1,9 @@
 @PACKAGE_INIT@
-
-if (TARGET ztd::static_containers)
+include(CMakeFindDependencyMacro)
+find_dependency(ztd.idk CONFIG)
+include("${CMAKE_CURRENT_LIST_DIR}/ztd.static_containers-targets.cmake")
+if (TARGET ztd.static_containers)
+	add_library(ztd::static_containers ALIAS ztd.static_containers)
 	get_target_property(ZTD_STATIC_CONTAINERS_INCLUDE_DIRS
 		ztd.static_containers INTERFACE_INCLUDE_DIRECTORIES)
 	set_and_check(ZTD_STATIC_CONTAINERS_INCLUDE_DIRS "${ZTD_STATIC_CONTAINERS_INCLUDE_DIRS}")