fixed CMakeLists

This commit is contained in:
tastytea 2018-01-13 19:03:10 +01:00
parent 79bd5740d9
commit 34f81d89d6
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
3 changed files with 4 additions and 18 deletions

View File

@ -3,23 +3,10 @@ project (mastodon-cpp
VERSION 0.1.1 VERSION 0.1.1
LANGUAGES CXX LANGUAGES CXX
) )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
# Write SHA1 hash and date of current git commit to a header file. Also version. # Write version in header
find_package(Git)
if(Git_FOUND)
# force regeneration of version.hpp on each build
file(REMOVE "${PROJECT_BINARY_DIR}/version.hpp")
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always --abbrev=0 --dirty
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "${GIT_EXECUTABLE}" log -1 --format=%aI --date=iso-strict
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
include_directories(${MY_SOURCE_DIR}/src) include_directories(${MY_SOURCE_DIR}/src)
configure_file ( configure_file (
"${PROJECT_SOURCE_DIR}/src/version.hpp.in" "${PROJECT_SOURCE_DIR}/src/version.hpp.in"
@ -39,7 +26,7 @@ set_target_properties(mastodon-cpp PROPERTIES
) )
install(TARGETS mastodon-cpp DESTINATION lib) install(TARGETS mastodon-cpp DESTINATION lib)
target_link_libraries(mastodon-cpp boost_system ssl crypto) target_link_libraries(mastodon-cpp boost_system ssl crypto)
install(FILES ${PROJECT_SOURCE_DIR}/src/lib/mastodon-cpp.hpp DESTINATION include) install(FILES ${PROJECT_SOURCE_DIR}/src/mastodon-cpp.hpp DESTINATION include)
# Example client # Example client
if(NOT LIB_ONLY) if(NOT LIB_ONLY)

View File

@ -66,6 +66,7 @@ If you use a debug build, you get more verbose error messages.
* [ ] Implement all DELETE calls * [ ] Implement all DELETE calls
* Version 0.3.0 * Version 0.3.0
* [ ] Handle HTTP statuses 301 & 302 * [ ] Handle HTTP statuses 301 & 302
* [ ] Support registering as an application
* Later * Later
* [ ] Escape user input * [ ] Escape user input
* [ ] Asynchronous I/O * [ ] Asynchronous I/O

View File

@ -6,8 +6,6 @@ namespace Mastodon
namespace global namespace global
{ {
static constexpr char version[] = "@PROJECT_VERSION@"; static constexpr char version[] = "@PROJECT_VERSION@";
static constexpr char git_sha1[] ="@GIT_SHA1@";
static constexpr char git_date[] ="@GIT_DATE@";
} }
} }