2015-09-28 19:48:46 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
2014-06-06 20:22:12 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
2015-10-01 13:32:30 +00:00
|
|
|
project(duckscraper VERSION 0.2.1 LANGUAGES CXX)
|
2014-06-06 20:22:12 +00:00
|
|
|
|
2015-09-28 21:44:11 +00:00
|
|
|
option(BUILD_SHARED_TIDY "Wheter you want to build tidy-html5 as a shared library" OFF)
|
|
|
|
|
2014-06-07 20:07:13 +00:00
|
|
|
include(GetGitRevisionDescription)
|
2014-06-06 23:15:06 +00:00
|
|
|
find_package(PugiXML REQUIRED)
|
2015-09-28 19:48:46 +00:00
|
|
|
find_package(Boost 1.32.0 COMPONENTS program_options)
|
2014-06-07 18:44:43 +00:00
|
|
|
|
2018-01-10 11:09:56 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -g -O0 -fno-omit-frame-pointer")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -Wextra -g -O3 -fomit-frame-pointer")
|
2014-06-06 20:22:12 +00:00
|
|
|
|
2014-06-07 20:07:13 +00:00
|
|
|
set(DEFAULT_USER_AGENT "DuckScraper")
|
|
|
|
set(PROJECT_VERSION_BETA "1")
|
|
|
|
get_git_head_revision(GIT_REFSPEC PROJECT_VERSION_GIT)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}Config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.h"
|
|
|
|
)
|
|
|
|
|
2014-06-06 18:24:24 +00:00
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
src/main.cpp
|
2018-01-10 11:09:56 +00:00
|
|
|
src/html_pool.cpp
|
2014-06-07 20:07:13 +00:00
|
|
|
src/htmlretrieve.cpp
|
2015-09-29 23:13:48 +00:00
|
|
|
src/commandline.cpp
|
2018-01-10 11:09:56 +00:00
|
|
|
src/scraplang/parse.cpp
|
|
|
|
src/scraplang/apply.cpp
|
2015-10-01 12:18:02 +00:00
|
|
|
src/xpath.cpp
|
2018-02-08 00:54:17 +00:00
|
|
|
src/read_all.cpp
|
2018-01-17 23:24:35 +00:00
|
|
|
src/scraplang/xpath_runner.cpp
|
2014-06-06 18:24:24 +00:00
|
|
|
)
|
2014-06-06 20:22:12 +00:00
|
|
|
|
2018-01-10 11:09:56 +00:00
|
|
|
target_include_directories(${PROJECT_NAME} SYSTEM
|
|
|
|
PRIVATE lib/tidy/include
|
|
|
|
PRIVATE ${PUGIXML_INCLUDE_DIR}
|
|
|
|
PRIVATE lib/curlcpp/include
|
|
|
|
PRIVATE ${Boost_INCLUDE_DIRS}
|
|
|
|
PRIVATE lib/mstch/include
|
|
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PRIVATE src/
|
|
|
|
PRIVATE "${PROJECT_BINARY_DIR}"
|
|
|
|
)
|
|
|
|
|
2015-09-28 21:44:11 +00:00
|
|
|
if (BUILD_SHARED_TIDY)
|
|
|
|
set(TIDY_LIB "tidy-share")
|
|
|
|
else(BUILD_SHARED_TIDY)
|
|
|
|
set(TIDY_LIB "tidy-static")
|
|
|
|
endif(BUILD_SHARED_TIDY)
|
|
|
|
|
2014-06-06 20:22:12 +00:00
|
|
|
target_link_libraries(${PROJECT_NAME}
|
2018-01-10 11:09:56 +00:00
|
|
|
PRIVATE ${TIDY_LIB}
|
|
|
|
PRIVATE ${PUGIXML_LIBRARIES}
|
|
|
|
PRIVATE curlcpp
|
|
|
|
PRIVATE ${Boost_LIBRARIES}
|
|
|
|
PRIVATE mstch
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME}
|
|
|
|
PRIVATE $<$<CONFIG:DEBUG>:KAK_DEBUG>
|
2014-06-06 20:22:12 +00:00
|
|
|
)
|
2015-09-28 19:48:46 +00:00
|
|
|
|
|
|
|
#unset those variables so cmake files from dependencies won't complain about
|
|
|
|
#new/old policy. Those unset statements can be removed once both libraries bump
|
|
|
|
#their cmake_minimum_required to 3.0+.
|
|
|
|
unset(PROJECT_VERSION_MAJOR)
|
|
|
|
unset(PROJECT_VERSION_MINOR)
|
2015-10-01 13:32:30 +00:00
|
|
|
unset(PROJECT_VERSION_PATCH)
|
2015-09-28 19:48:46 +00:00
|
|
|
unset(PROJECT_VERSION)
|
2015-09-28 21:44:11 +00:00
|
|
|
set(BUILD_SHARED_LIB ${BUILD_SHARED_TIDY}) #for tidy
|
2015-09-28 19:48:46 +00:00
|
|
|
add_subdirectory(lib/tidy)
|
|
|
|
add_subdirectory(lib/curlcpp)
|
2018-01-10 11:09:56 +00:00
|
|
|
add_subdirectory(lib/mstch)
|