This commit is contained in:
parent
2f962d04eb
commit
a1083b5c18
|
@ -67,17 +67,17 @@ if(WITH_EASY)
|
||||||
else()
|
else()
|
||||||
file(GLOB sources src/*.cpp src/api/*.cpp)
|
file(GLOB sources src/*.cpp src/api/*.cpp)
|
||||||
endif()
|
endif()
|
||||||
add_library(${CMAKE_PROJECT_NAME} SHARED ${sources})
|
add_library(${PROJECT_NAME} SHARED ${sources})
|
||||||
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
SOVERSION ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR}
|
SOVERSION ${${PROJECT_NAME}_VERSION_MAJOR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WITH_EASY)
|
if(WITH_EASY)
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
${CURLPP_LIBRARIES} pthread ${JSONCPP_LIBRARIES})
|
${CURLPP_LIBRARIES} pthread ${JSONCPP_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
${CURLPP_LIBRARIES} pthread)
|
${CURLPP_LIBRARIES} pthread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ if(WITH_EXAMPLES)
|
||||||
foreach(src ${sources_examples})
|
foreach(src ${sources_examples})
|
||||||
get_filename_component(bin ${src} NAME_WE)
|
get_filename_component(bin ${src} NAME_WE)
|
||||||
add_executable(${bin} ${src})
|
add_executable(${bin} ${src})
|
||||||
target_link_libraries(${bin} pthread ${JSONCPP_LIBRARIES} ${CMAKE_PROJECT_NAME})
|
target_link_libraries(${bin} pthread ${JSONCPP_LIBRARIES} ${PROJECT_NAME})
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -97,17 +97,17 @@ if(WITH_TESTS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Install library and header files
|
# Install library and header files
|
||||||
install(TARGETS ${CMAKE_PROJECT_NAME} LIBRARY
|
install(TARGETS ${PROJECT_NAME} LIBRARY
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
install(FILES src/mastodon-cpp.hpp src/return_types.hpp src/types.hpp
|
install(FILES src/mastodon-cpp.hpp src/return_types.hpp src/types.hpp
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME})
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
|
||||||
if(WITH_EASY)
|
if(WITH_EASY)
|
||||||
file(GLOB easy_header src/easy/*.hpp)
|
file(GLOB easy_header src/easy/*.hpp)
|
||||||
install(FILES ${easy_header}
|
install(FILES ${easy_header}
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}/easy)
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/easy)
|
||||||
file(GLOB easy_entities_header src/easy/entities/*.hpp)
|
file(GLOB easy_entities_header src/easy/entities/*.hpp)
|
||||||
install(FILES ${easy_entities_header}
|
install(FILES ${easy_entities_header}
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}/easy/entities)
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/easy/entities)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compile & install documentation
|
# Compile & install documentation
|
||||||
|
@ -115,12 +115,12 @@ if(WITH_DOC)
|
||||||
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/doc/html
|
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/doc/html
|
||||||
COMMAND ./build_doc.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
COMMAND ./build_doc.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||||
add_custom_target(doc DEPENDS doc/html)
|
add_custom_target(doc DEPENDS doc/html)
|
||||||
add_dependencies(${CMAKE_PROJECT_NAME} doc)
|
add_dependencies(${PROJECT_NAME} doc)
|
||||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/doc/html
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/doc/html
|
||||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}/${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}-${PROJECT_VERSION})
|
||||||
file(GLOB examples examples/example*.cpp)
|
file(GLOB examples examples/example*.cpp)
|
||||||
install(FILES ${examples}
|
install(FILES ${examples}
|
||||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}/${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}/examples)
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}-${PROJECT_VERSION}/examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Packages
|
# Packages
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${mastodon-cpp_VERSION_MAJOR})
|
set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR ${mastodon-cpp_VERSION_MINOR})
|
set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${mastodon-cpp_VERSION_PATCH})
|
set(CPACK_PACKAGE_VERSION_PATCH ${${PROJECT_NAME}_VERSION_PATCH})
|
||||||
set(CPACK_PACKAGE_VERSION ${mastodon-cpp_VERSION})
|
set(CPACK_PACKAGE_VERSION ${mastodon-cpp_VERSION})
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ wrapper for the Mastodon API")
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ wrapper for the Mastodon API")
|
||||||
set(CPACK_PACKAGE_CONTACT "tastytea <tastytea@tastytea.de>")
|
set(CPACK_PACKAGE_CONTACT "tastytea <tastytea@tastytea.de>")
|
||||||
|
@ -24,7 +24,7 @@ set(CPACK_GENERATOR "TGZ")
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
|
|
||||||
if (WITH_DEB)
|
if (WITH_DEB)
|
||||||
set(CPACK_PACKAGE_NAME "lib${CMAKE_PROJECT_NAME}")
|
set(CPACK_PACKAGE_NAME "lib${PROJECT_NAME}")
|
||||||
set(CPACK_GENERATOR "DEB")
|
set(CPACK_GENERATOR "DEB")
|
||||||
set(CPACK_SOURCE_GENERATOR "DEB")
|
set(CPACK_SOURCE_GENERATOR "DEB")
|
||||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://schlomp.space/tastytea/mastodon-cpp")
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://schlomp.space/tastytea/mastodon-cpp")
|
||||||
|
@ -39,7 +39,7 @@ if (WITH_DEB)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_RPM)
|
if (WITH_RPM)
|
||||||
set(CPACK_PACKAGE_NAME "lib${CMAKE_PROJECT_NAME}")
|
set(CPACK_PACKAGE_NAME "lib${PROJECT_NAME}")
|
||||||
set(CPACK_GENERATOR "RPM")
|
set(CPACK_GENERATOR "RPM")
|
||||||
set(CPACK_SOURCE_GENERATOR "RPM")
|
set(CPACK_SOURCE_GENERATOR "RPM")
|
||||||
set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
|
set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
|
||||||
|
|
|
@ -5,7 +5,7 @@ find_package(Catch2)
|
||||||
if(Catch2_FOUND) # Catch 2.x
|
if(Catch2_FOUND) # Catch 2.x
|
||||||
include(Catch)
|
include(Catch)
|
||||||
add_executable(all_tests tests/main.cpp ${sources_tests})
|
add_executable(all_tests tests/main.cpp ${sources_tests})
|
||||||
target_link_libraries(all_tests ${CMAKE_PROJECT_NAME} Catch2::Catch2)
|
target_link_libraries(all_tests ${PROJECT_NAME} Catch2::Catch2)
|
||||||
target_include_directories(all_tests PRIVATE "/usr/include/catch2")
|
target_include_directories(all_tests PRIVATE "/usr/include/catch2")
|
||||||
catch_discover_tests(all_tests)
|
catch_discover_tests(all_tests)
|
||||||
else() # Catch 1.x
|
else() # Catch 1.x
|
||||||
|
@ -14,7 +14,7 @@ else() # Catch 1.x
|
||||||
foreach(src ${sources_tests})
|
foreach(src ${sources_tests})
|
||||||
get_filename_component(bin ${src} NAME_WE)
|
get_filename_component(bin ${src} NAME_WE)
|
||||||
add_executable(${bin} tests/main.cpp ${src})
|
add_executable(${bin} tests/main.cpp ${src})
|
||||||
target_link_libraries(${bin} ${CMAKE_PROJECT_NAME})
|
target_link_libraries(${bin} ${PROJECT_NAME})
|
||||||
add_test(${bin} ${bin})
|
add_test(${bin} ${bin})
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
|
|
Reference in New Issue
Block a user