aboutsummaryrefslogtreecommitdiff
path: root/ports/stx/CMakeLists.patch
blob: 70aaccbfda8e73d195422203fa98cf05bd40ca10 (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
69
70
71
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4ed99e..b0d2b15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -204,12 +204,7 @@ endif()
 # ===============================================
 
 if(STX_ENABLE_BACKTRACE)
-  if(NOT EXISTS third_party/abseil)
-    execute_process(
-      COMMAND git submodule update --init --recursive third_party/abseil
-      WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
-  endif()
-  add_subdirectory(third_party/abseil)
+  find_package(absl CONFIG REQUIRED)
 endif()
 
 # the atomics library doesn't automatically link on my Android phone
@@ -246,13 +241,17 @@ else()
   add_library(stx STATIC ${STX_SRCS})
 endif()
 
-target_include_directories(stx PUBLIC include)
+target_include_directories(stx PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+    $<INSTALL_INTERFACE:include>
+)
+
 target_compile_options(stx PRIVATE ${STX_FLAGS} ${STX_WARNING_FLAGS})
 target_compile_definitions(stx PUBLIC ${STX_COMPILER_DEFS})
 target_link_libraries(stx ${STX_LIB_DEPENDENCIES})
 
 if(STX_ENABLE_BACKTRACE)
-  target_link_libraries(stx absl::stacktrace absl::symbolize)
+  target_link_libraries(stx PUBLIC absl::stacktrace absl::symbolize)
 endif()
 
 if(ANDROID)
@@ -288,6 +287,7 @@ endif()
 #
 # ===============================================
 
+
 if(STX_BUILD_BENCHMARKS)
 
   if(NOT EXISTS third_party/benchmark)
@@ -433,3 +433,24 @@ if(STX_BUILD_DOCS)
        DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/docs/html/assets)
 
 endif()
+
+install(
+    TARGETS stx
+    EXPORT stx
+    ARCHIVE DESTINATION lib
+    LIBRARY DESTINATION lib
+    RUNTIME DESTINATION bin
+)
+
+install(
+    DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
+    DESTINATION include
+    FILES_MATCHING PATTERN "*.h*")
+
+install(
+    EXPORT stx
+    DESTINATION share/stx
+    FILE stxConfig.cmake
+    NAMESPACE stx::
+)
+