duckscraper/CMakeLists.txt

65 lines
1.8 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_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -Wall -Wextra -g -O0 -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -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 20:22:12 +00:00
include_directories(SYSTEM
lib/tidy/include
${PUGIXML_INCLUDE_DIR}
lib/curlcpp/include
${Boost_INCLUDE_DIRS}
2014-06-06 20:22:12 +00:00
)
include_directories(
src/
"${PROJECT_BINARY_DIR}"
)
2014-06-06 20:22:12 +00:00
2014-06-06 18:24:24 +00:00
add_executable(${PROJECT_NAME}
src/main.cpp
src/htmlretrieve.cpp
src/commandline.cpp
2015-09-30 23:32:27 +00:00
src/scraplang/scraplang.cpp
src/xpath.cpp
2014-06-06 18:24:24 +00:00
)
2014-06-06 20:22:12 +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}
${TIDY_LIB}
${PUGIXML_LIBRARIES}
curlcpp
${Boost_LIBRARIES}
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)