Added option to compile to static library
the build was successful Details

This commit is contained in:
tastytea 2018-07-19 12:02:42 +02:00
parent 63fd9f581c
commit fb0a7c0f7f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 21 additions and 4 deletions

View File

@ -61,8 +61,8 @@ else()
endif()
add_library(mastodon-cpp SHARED ${sources})
set_target_properties(mastodon-cpp PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${mastodon-cpp_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
SOVERSION ${mastodon-cpp_VERSION_MAJOR}
)
if(WITHOUT_EASY)
@ -71,6 +71,12 @@ else()
target_link_libraries(mastodon-cpp ${CURLPP_LIBRARIES} ${JSONCPP_LIBRARIES})
endif()
if(WITH_STATIC)
add_library(mastodon-cpp_static STATIC ${sources})
set_target_properties(mastodon-cpp_static PROPERTIES
OUTPUT_NAME mastodon-cpp)
endif()
# Compile examples
if(WITH_EXAMPLES)
file(GLOB sources_examples examples/*.cpp)
@ -95,6 +101,10 @@ endif()
# Install library and header files
install(TARGETS mastodon-cpp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(WITH_STATIC)
install(TARGETS mastodon-cpp_static LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
install(FILES src/mastodon-cpp.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mastodon-cpp)
if(NOT WITHOUT_EASY)

View File

@ -10,7 +10,7 @@ SRC_URI="https://schlomp.space/tastytea/mastodon-cpp/archive/${PV}.tar.gz -> ${P
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc debug examples"
IUSE="doc debug examples static-libs"
RDEPEND=">=dev-cpp/curlpp-0.8.1
>=dev-libs/jsoncpp-1.8.4"
DEPEND=">=dev-util/cmake-3.9.6
@ -34,6 +34,9 @@ src_configure() {
else
mycmakeargs+=(-DCMAKE_BUILD_TYPE=Release)
fi
if use static-libs; then
mycmakeargs+=(-DWITH_STATIC=YES)
fi
cmake-utils_src_configure
}

View File

@ -10,7 +10,7 @@ EGIT_REPO_URI="https://schlomp.space/tastytea/mastodon-cpp.git"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""
IUSE="doc debug examples"
IUSE="doc debug examples static-libs"
RDEPEND=">=dev-cpp/curlpp-0.8.1
>=dev-libs/jsoncpp-1.8.1"
DEPEND=">=dev-util/cmake-3.9.6
@ -33,6 +33,10 @@ src_configure() {
mycmakeargs+=(-DCMAKE_BUILD_TYPE=Release)
fi
if use static-libs; then
mycmakeargs+=(-DWITH_STATIC=YES)
fi
cmake-utils_src_configure
}