bugfix: some examples didn't compile with -DWITHOUT_EASY
This commit is contained in:
rodič
e18c9b1c35
revize
63fd9f581c
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.7)
|
||||
project (mastodon-cpp
|
||||
VERSION 0.18.2
|
||||
VERSION 0.18.3
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,9 @@ include(GNUInstallDirs)
|
|||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(CURLPP REQUIRED curlpp)
|
||||
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
|
||||
if(NOT WITHOUT_EASY)
|
||||
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
@ -62,6 +64,7 @@ set_target_properties(mastodon-cpp PROPERTIES
|
|||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${mastodon-cpp_VERSION_MAJOR}
|
||||
)
|
||||
|
||||
if(WITHOUT_EASY)
|
||||
target_link_libraries(mastodon-cpp ${CURLPP_LIBRARIES})
|
||||
else()
|
||||
|
|
|
@ -120,6 +120,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
#else
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
printf("mastodon-cpp was compiled without Easy support.\n");
|
||||
|
|
|
@ -102,6 +102,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
#else
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
printf("mastodon-cpp was compiled without Easy support.\n");
|
||||
|
|
|
@ -121,6 +121,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
#else
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
printf("mastodon-cpp was compiled without Easy support.\n");
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
* Get fields from own account.
|
||||
*/
|
||||
|
||||
// Don't compile this if the Easy-interface is turned off
|
||||
#ifndef WITHOUT_EASY
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -43,3 +46,12 @@ int main(int argc, char *argv[])
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
printf("mastodon-cpp was compiled without Easy support.\n");
|
||||
return 255;
|
||||
}
|
||||
#endif // WITHOUT_EASY
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
*/
|
||||
|
||||
// Don't compile this if the Easy-interface is turned off
|
||||
#ifndef WITHOUT_EASY
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdint>
|
||||
#include "mastodon-cpp.hpp"
|
||||
|
@ -25,3 +28,12 @@ int main(int argc, char *argv[])
|
|||
std::cout << ret << ": " << answer << '\n';
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
printf("mastodon-cpp was compiled without Easy support.\n");
|
||||
return 0;
|
||||
}
|
||||
#endif // WITHOUT_EASY
|
||||
|
|
Odkázat v novém úkolu