duckscraper/CMakeLists.txt

79 lines
2.2 KiB
Text
Raw Normal View History

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
option(BUILD_SHARED_TIDY "Wheter you want to build tidy-html5 as a shared library" OFF)
include(GetGitRevisionDescription)
find_package(PugiXML REQUIRED)
find_package(Boost 1.32.0 COMPONENTS program_options)
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
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
src/html_pool.cpp
src/htmlretrieve.cpp
src/commandline.cpp
src/scraplang/parse.cpp
src/scraplang/apply.cpp
src/xpath.cpp
src/read_all.cpp
src/scraplang/xpath_runner.cpp
2014-06-06 18:24:24 +00:00
)
2014-06-06 20:22:12 +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}"
)
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}
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
)
#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)
unset(PROJECT_VERSION)
set(BUILD_SHARED_LIB ${BUILD_SHARED_TIDY}) #for tidy
add_subdirectory(lib/tidy)
add_subdirectory(lib/curlcpp)
add_subdirectory(lib/mstch)