Browse Source

bugfix: some examples didn't compile with -DWITHOUT_EASY

tastytea 5 months ago
parent
commit
63fd9f581c
Signed by: tastytea <tastytea@tastytea.de> GPG Key ID: CFC39497F1B26E07

+ 5
- 2
CMakeLists.txt View File

@@ -1,6 +1,6 @@
1 1
 cmake_minimum_required (VERSION 3.7)
2 2
 project (mastodon-cpp
3
-         VERSION 0.18.2
3
+         VERSION 0.18.3
4 4
          LANGUAGES CXX
5 5
 )
6 6
 
@@ -8,7 +8,9 @@ include(GNUInstallDirs)
8 8
 find_package(PkgConfig REQUIRED)
9 9
 find_package(PkgConfig REQUIRED)
10 10
 pkg_check_modules(CURLPP REQUIRED curlpp)
11
-pkg_check_modules(JSONCPP REQUIRED jsoncpp)
11
+if(NOT WITHOUT_EASY)
12
+    pkg_check_modules(JSONCPP REQUIRED jsoncpp)
13
+endif()
12 14
 
13 15
 set(CMAKE_CXX_STANDARD 14)
14 16
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -62,6 +64,7 @@ set_target_properties(mastodon-cpp PROPERTIES
62 64
     VERSION ${PROJECT_VERSION}
63 65
     SOVERSION ${mastodon-cpp_VERSION_MAJOR}
64 66
 )
67
+
65 68
 if(WITHOUT_EASY)
66 69
     target_link_libraries(mastodon-cpp ${CURLPP_LIBRARIES})
67 70
 else()

+ 1
- 0
examples/example12_easy_laststatus.cpp View File

@@ -120,6 +120,7 @@ int main(int argc, char *argv[])
120 120
 }
121 121
 
122 122
 #else
123
+#include <cstdio>
123 124
 int main()
124 125
 {
125 126
     printf("mastodon-cpp was compiled without Easy support.\n");

+ 1
- 0
examples/example13_easy_stream.cpp View File

@@ -102,6 +102,7 @@ int main(int argc, char *argv[])
102 102
 }
103 103
 
104 104
 #else
105
+#include <cstdio>
105 106
 int main()
106 107
 {
107 108
     printf("mastodon-cpp was compiled without Easy support.\n");

+ 1
- 0
examples/example14_easy_treeview.cpp View File

@@ -121,6 +121,7 @@ int main(int argc, char *argv[])
121 121
 }
122 122
 
123 123
 #else
124
+#include <cstdio>
124 125
 int main()
125 126
 {
126 127
     printf("mastodon-cpp was compiled without Easy support.\n");

+ 12
- 0
examples/example16_account_fields.cpp View File

@@ -2,6 +2,9 @@
2 2
  *  Get fields from own account.
3 3
  */
4 4
 
5
+// Don't compile this if the Easy-interface is turned off
6
+#ifndef WITHOUT_EASY
7
+
5 8
 #include <iostream>
6 9
 #include <vector>
7 10
 #include <string>
@@ -43,3 +46,12 @@ int main(int argc, char *argv[])
43 46
 
44 47
     return 0;
45 48
 }
49
+
50
+#else
51
+#include <cstdio>
52
+int main()
53
+{
54
+    printf("mastodon-cpp was compiled without Easy support.\n");
55
+    return 255;
56
+}
57
+#endif  // WITHOUT_EASY

+ 12
- 0
tests/test_02_easy_get_public_timeline.cpp View File

@@ -1,6 +1,9 @@
1 1
 /*  This file is part of mastodon-cpp.
2 2
  */
3 3
 
4
+// Don't compile this if the Easy-interface is turned off
5
+#ifndef WITHOUT_EASY
6
+
4 7
 #include <iostream>
5 8
 #include <cstdint>
6 9
 #include "mastodon-cpp.hpp"
@@ -25,3 +28,12 @@ int main(int argc, char *argv[])
25 28
     std::cout << ret << ": " << answer << '\n';
26 29
     return 1;
27 30
 }
31
+
32
+#else
33
+#include <cstdio>
34
+int main()
35
+{
36
+    printf("mastodon-cpp was compiled without Easy support.\n");
37
+    return 0;
38
+}
39
+#endif  // WITHOUT_EASY

Loading…
Cancel
Save