2012-04-25 20:13:17 +04:00
|
|
|
project(grive)
|
|
|
|
|
2012-04-26 08:03:30 +04:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
2012-04-29 20:48:11 +04:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
2012-04-26 08:03:30 +04:00
|
|
|
|
2012-04-29 20:48:11 +04:00
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
find_package(JSONC REQUIRED)
|
|
|
|
find_package(CURL REQUIRED)
|
2012-04-29 21:16:13 +04:00
|
|
|
find_package(CppUnit)
|
2012-04-29 20:03:04 +04:00
|
|
|
|
2012-04-29 21:16:13 +04:00
|
|
|
IF ( CPPUNIT_FOUND )
|
2012-04-30 20:32:29 +04:00
|
|
|
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
|
2012-04-29 21:16:13 +04:00
|
|
|
ENDIF ( CPPUNIT_FOUND )
|
2012-04-29 20:03:04 +04:00
|
|
|
|
2012-04-27 11:41:46 +04:00
|
|
|
include_directories(
|
|
|
|
${grive_SOURCE_DIR}/src
|
2012-04-30 20:32:29 +04:00
|
|
|
${OPT_INCS}
|
2012-04-27 11:41:46 +04:00
|
|
|
)
|
2012-04-27 06:49:33 +04:00
|
|
|
|
2012-04-29 17:20:04 +04:00
|
|
|
file(GLOB DRIVE_HEADERS
|
|
|
|
${grive_SOURCE_DIR}/src/drive/*.hh
|
|
|
|
)
|
|
|
|
|
|
|
|
file (GLOB PROTOCOL_HEADERS
|
|
|
|
${grive_SOURCE_DIR}/src/protocol/*.hh
|
|
|
|
)
|
|
|
|
|
|
|
|
file (GLOB UTIL_HEADERS
|
|
|
|
${grive_SOURCE_DIR}/src/util/*.hh
|
|
|
|
)
|
|
|
|
|
2012-05-01 14:16:26 +04:00
|
|
|
add_library( fgrive SHARED
|
2012-04-27 06:49:33 +04:00
|
|
|
src/drive/Collection.cc
|
|
|
|
src/drive/Drive.cc
|
2012-05-01 19:24:40 +04:00
|
|
|
src/drive/File.cc
|
2012-04-27 06:49:33 +04:00
|
|
|
src/protocol/Download.cc
|
2012-04-26 08:21:40 +04:00
|
|
|
src/protocol/HTTP.cc
|
|
|
|
src/protocol/Json.cc
|
2012-04-27 06:49:33 +04:00
|
|
|
src/protocol/OAuth2.cc
|
2012-04-28 20:01:45 +04:00
|
|
|
src/util/Crypt.cc
|
2012-04-27 21:52:02 +04:00
|
|
|
src/util/DateTime.cc
|
2012-04-27 06:49:33 +04:00
|
|
|
src/util/OS.cc
|
2012-05-01 13:44:17 +04:00
|
|
|
src/util/Path.cc
|
2012-04-27 06:49:33 +04:00
|
|
|
)
|
2012-04-25 20:13:17 +04:00
|
|
|
|
2012-05-01 14:16:26 +04:00
|
|
|
add_executable( grive
|
2012-04-29 17:20:04 +04:00
|
|
|
src/main.cc
|
|
|
|
)
|
|
|
|
|
2012-05-01 14:16:26 +04:00
|
|
|
target_link_libraries( fgrive
|
2012-04-30 20:32:29 +04:00
|
|
|
${CURL_LIBRARIES}
|
|
|
|
${JSONC_LIBRARY}
|
2012-04-27 11:41:46 +04:00
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2012-05-01 14:16:26 +04:00
|
|
|
target_link_libraries( grive
|
|
|
|
fgrive
|
2012-04-29 17:20:04 +04:00
|
|
|
)
|
|
|
|
|
2012-05-01 14:16:26 +04:00
|
|
|
set_target_properties(fgrive PROPERTIES
|
2012-04-29 17:20:04 +04:00
|
|
|
SOVERSION 0 VERSION 0.0.1
|
|
|
|
)
|
2012-04-29 20:03:04 +04:00
|
|
|
|
2012-05-01 17:40:36 +04:00
|
|
|
IF ( CPPUNIT_FOUND )
|
2012-04-30 20:32:29 +04:00
|
|
|
add_executable( unittest
|
2012-05-01 13:44:17 +04:00
|
|
|
test/UnitTest.cc
|
2012-04-30 20:32:29 +04:00
|
|
|
test/util/DateTimeTest.cc
|
|
|
|
test/util/FunctionTest.cc
|
2012-05-01 13:44:17 +04:00
|
|
|
test/util/PathTest.cc
|
2012-04-30 20:32:29 +04:00
|
|
|
)
|
2012-05-01 17:40:36 +04:00
|
|
|
|
2012-04-29 22:38:56 +04:00
|
|
|
target_link_libraries( unittest
|
2012-05-01 17:40:36 +04:00
|
|
|
fgrive
|
2012-04-30 20:32:29 +04:00
|
|
|
${CPPUNIT_LIBRARY}
|
2012-04-29 22:38:56 +04:00
|
|
|
)
|
|
|
|
else ( CPPUNIT_FOUND )
|
|
|
|
message( STATUS "skip building unittest" )
|
2012-04-29 20:03:04 +04:00
|
|
|
endif ( CPPUNIT_FOUND )
|
|
|
|
|
2012-04-29 21:18:21 +04:00
|
|
|
|
2012-04-29 17:20:04 +04:00
|
|
|
## Install targets
|
2012-05-01 14:16:26 +04:00
|
|
|
install(TARGETS fgrive LIBRARY DESTINATION lib)
|
|
|
|
install(TARGETS grive RUNTIME DESTINATION bin)
|
2012-04-29 17:20:04 +04:00
|
|
|
install(FILES ${DRIVE_HEADERS} DESTINATION include/grive/drive)
|
|
|
|
install(FILES ${PROTOCOL_HEADERS} DESTINATION include/grive/protocol)
|
|
|
|
install(FILES ${UTIL_HEADERS} DESTINATION include/grive/util)
|