Add implementation to cache reader
[dueringa_WikiWalker.git] / src / CMakeLists.txt
blob8009f99011749190a8a848e80051b706374b61c3
1 cmake_minimum_required(VERSION 2.8.11)
2 project(WikiWalker)
4 SET(walker_version "git-prerelease")
6 execute_process(
7         COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR} describe --always --dirty --tags
8         RESULT_VARIABLE GIT_RETCODE
9         OUTPUT_VARIABLE GIT_OUTPUT_VERSION
10         ERROR_VARIABLE GIT_RAN_ERROR
11         OUTPUT_STRIP_TRAILING_WHITESPACE
14 #message("Git result: ${GIT_RETCODE} / ${GIT_OUTPUT_VERSION} / ${GIT_RAN_ERROR}")
16 # exit status 0 means successful
17 if (GIT_RETCODE)
18         set(GIT_RAN_SUCCESSFULLY 0)
19 else (GIT_RETCODE)
20         set(GIT_RAN_SUCCESSFULLY 1)
21 endif (GIT_RETCODE)
23 # also, project_...?
24 # overwriting version.h in ok (?), I want the generated one to be preferred
25 # and I guess include_directories in only appended...
26 configure_file(
27         "${CMAKE_CURRENT_SOURCE_DIR}/version.h.in"
28         "${CMAKE_CURRENT_BINARY_DIR}/version.h"
31 find_package(CURL REQUIRED)
32 find_package(Boost
33         REQUIRED
34         COMPONENTS program_options
37 ## huh, path spec is relative to... ???
38 include_directories(
39         ../lib/jsoncpp/
40         ${CURL_INCLUDE_DIRS}
41         ${CMAKE_CURRENT_BINARY_DIR}
42         ${Boost_INCLUDE_DIR}
45 # Compiler options
46 # TODO: What's the difference between this and SET_SOURCE_FILES_PROPERTIES?
47 add_definitions(-Wall)
48 add_definitions(-Wextra)
49 add_definitions(-Wshadow)
50 add_definitions(-std=c++11)
51 add_definitions(-Werror=return-type)
53 # Linker options
55 # Define the CXX sources
56 set ( CXX_SRCS
57     ${CMAKE_CURRENT_SOURCE_DIR}/CurlWikiGrabber.cpp
58     ${CMAKE_CURRENT_SOURCE_DIR}/CurlUrlCreator.cpp
59     ${CMAKE_CURRENT_SOURCE_DIR}/WikimediaJsonToArticleConverter.cpp
60     ${CMAKE_CURRENT_SOURCE_DIR}/CacheJsonToArticleConverter.cpp
61     ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
62     ${CMAKE_CURRENT_SOURCE_DIR}/ArticleCollection.cpp
63     ${CMAKE_CURRENT_SOURCE_DIR}/WikiWalker.cpp
64     ${CMAKE_CURRENT_SOURCE_DIR}/ToJsonWriter.cpp
65     ${CMAKE_CURRENT_SOURCE_DIR}/ToGraphvizWriter.cpp
66     ${CMAKE_CURRENT_SOURCE_DIR}/Article.cpp
67     ${CMAKE_CURRENT_SOURCE_DIR}/BoostPoCommandLineParser.cpp
68     ${CMAKE_CURRENT_SOURCE_DIR}/../lib/jsoncpp/jsoncpp.cpp
71 add_executable(walker ${CXX_SRCS})
73 target_link_libraries(walker
74         ${CURL_LIBRARIES}
75         ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE}
78 install (TARGETS walker DESTINATION bin)
80 enable_testing()
81 add_test(NAME versiondisplay
82         COMMAND walker -v)