2012-05-02 19:30:49 +04:00
|
|
|
project(libgrive)
|
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
|
|
|
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
find_package(JSONC REQUIRED)
|
|
|
|
find_package(CURL REQUIRED)
|
2012-05-06 18:25:37 +04:00
|
|
|
find_package(EXPAT REQUIRED)
|
2012-05-02 19:30:49 +04:00
|
|
|
find_package(CppUnit)
|
2012-05-10 20:06:05 +04:00
|
|
|
find_package(Boost REQUIRED)
|
2012-05-02 19:30:49 +04:00
|
|
|
|
|
|
|
IF ( CPPUNIT_FOUND )
|
|
|
|
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
|
|
|
|
ENDIF ( CPPUNIT_FOUND )
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${libgrive_SOURCE_DIR}/src
|
|
|
|
${OPT_INCS}
|
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB DRIVE_HEADERS
|
|
|
|
${libgrive_SOURCE_DIR}/src/drive/*.hh
|
|
|
|
)
|
|
|
|
|
|
|
|
file (GLOB PROTOCOL_HEADERS
|
|
|
|
${libgrive_SOURCE_DIR}/src/protocol/*.hh
|
|
|
|
)
|
|
|
|
|
|
|
|
file (GLOB UTIL_HEADERS
|
|
|
|
${libgrive_SOURCE_DIR}/src/util/*.hh
|
|
|
|
)
|
|
|
|
|
2012-05-03 00:10:14 +04:00
|
|
|
file (GLOB XML_HEADERS
|
|
|
|
${libgrive_SOURCE_DIR}/src/xml/*.hh
|
|
|
|
)
|
|
|
|
|
2012-05-02 19:30:49 +04:00
|
|
|
file (GLOB LIBGRIVE_SRC
|
|
|
|
src/drive/*.cc
|
2012-05-05 22:21:39 +04:00
|
|
|
src/http/*.cc
|
2012-05-02 19:30:49 +04:00
|
|
|
src/protocol/*.cc
|
|
|
|
src/util/*.cc
|
2012-05-03 21:44:52 +04:00
|
|
|
src/xml/*.cc
|
2012-05-02 19:30:49 +04:00
|
|
|
)
|
|
|
|
|
2012-05-06 18:40:58 +04:00
|
|
|
add_definitions( -DVERSION="${GRIVE_VERSION}" )
|
|
|
|
|
2012-05-02 19:30:49 +04:00
|
|
|
add_library( grive SHARED ${LIBGRIVE_SRC} )
|
|
|
|
|
|
|
|
target_link_libraries( grive
|
|
|
|
${CURL_LIBRARIES}
|
|
|
|
${JSONC_LIBRARY}
|
|
|
|
${OPENSSL_LIBRARIES}
|
2012-05-05 09:01:23 +04:00
|
|
|
expat
|
2012-05-02 19:30:49 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(grive PROPERTIES
|
2012-05-06 19:16:43 +04:00
|
|
|
SOVERSION 0 VERSION ${GRIVE_VERSION}
|
2012-05-02 19:30:49 +04:00
|
|
|
)
|
|
|
|
|
2012-05-10 18:30:11 +04:00
|
|
|
if ( LIB_INSTALL_DIR )
|
|
|
|
else()
|
|
|
|
set ( LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
install(TARGETS grive LIBRARY DESTINATION ${LIB_INSTALL_DIR} )
|
2012-05-02 19:30:49 +04:00
|
|
|
install(FILES ${DRIVE_HEADERS} DESTINATION include/grive/drive)
|
|
|
|
install(FILES ${PROTOCOL_HEADERS} DESTINATION include/grive/protocol)
|
2012-05-03 00:10:14 +04:00
|
|
|
install(FILES ${UTIL_HEADERS} DESTINATION include/grive/util)
|
|
|
|
install(FILES ${XML_HEADERS} DESTINATION include/grive/xml)
|
2012-05-02 19:30:49 +04:00
|
|
|
|
|
|
|
IF ( CPPUNIT_FOUND )
|
|
|
|
message("-- Building unitary tests along with the library and the binary")
|
|
|
|
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
|
|
|
|
|
|
|
|
# list of test source files here
|
|
|
|
file(GLOB TEST_SRC
|
|
|
|
test/util/*.cc
|
2012-05-03 21:44:52 +04:00
|
|
|
test/xml/*.cc
|
2012-05-02 19:30:49 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
add_executable( unittest
|
|
|
|
test/UnitTest.cc
|
|
|
|
${TEST_SRC}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries( unittest
|
|
|
|
grive
|
|
|
|
${CPPUNIT_LIBRARY}
|
|
|
|
)
|
|
|
|
|
|
|
|
ENDIF ( CPPUNIT_FOUND )
|