grive2/libgrive/CMakeLists.txt

104 lines
2.1 KiB
CMake
Raw Normal View History

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)
find_package(EXPAT REQUIRED)
find_package(CppUnit)
2012-05-10 20:06:05 +04:00
find_package(Boost REQUIRED)
2012-05-13 10:08:04 +04:00
find_package(BFD)
IF ( CPPUNIT_FOUND )
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
ENDIF ( CPPUNIT_FOUND )
2012-05-13 10:08:04 +04:00
if ( BFD_FOUND )
set( OPT_LIBS ${DL_LIBRARY} ${BFD_LIBRARY} )
file( GLOB OPT_SRC
src/bfd/*.cc
)
endif ( BFD_FOUND )
include_directories(
${libgrive_SOURCE_DIR}/src
2012-05-10 20:12:48 +04:00
${libgrive_SOURCE_DIR}/test
${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
)
file (GLOB XML_HEADERS
${libgrive_SOURCE_DIR}/src/xml/*.hh
)
file (GLOB LIBGRIVE_SRC
src/drive/*.cc
src/http/*.cc
src/protocol/*.cc
src/util/*.cc
2012-05-03 21:44:52 +04:00
src/xml/*.cc
)
add_definitions( -DVERSION="${GRIVE_VERSION}" -DTEST_DATA="${libgrive_SOURCE_DIR}/test/data/" )
2012-05-06 18:40:58 +04:00
2012-05-13 10:08:04 +04:00
add_library( grive SHARED ${LIBGRIVE_SRC} ${OPT_SRC} )
target_link_libraries( grive
${CURL_LIBRARIES}
${JSONC_LIBRARY}
${OPENSSL_LIBRARIES}
2012-05-13 10:08:04 +04:00
${OPT_LIBS}
2012-05-05 09:01:23 +04:00
expat
)
set_target_properties(grive PROPERTIES
2012-05-06 19:16:43 +04:00
SOVERSION 0 VERSION ${GRIVE_VERSION}
)
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} )
install(FILES ${DRIVE_HEADERS} DESTINATION include/grive/drive)
install(FILES ${PROTOCOL_HEADERS} DESTINATION include/grive/protocol)
install(FILES ${UTIL_HEADERS} DESTINATION include/grive/util)
install(FILES ${XML_HEADERS} DESTINATION include/grive/xml)
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/drive/*.cc
test/util/*.cc
2012-05-03 21:44:52 +04:00
test/xml/*.cc
)
add_executable( unittest
test/UnitTest.cc
${TEST_SRC}
)
target_link_libraries( unittest
grive
${CPPUNIT_LIBRARY}
)
ENDIF ( CPPUNIT_FOUND )