60 lines
1.7 KiB
CMake
60 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
|
project(duckscraper VERSION 0.2 LANGUAGES CXX)
|
|
|
|
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")
|
|
|
|
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"
|
|
)
|
|
|
|
include_directories(SYSTEM
|
|
lib/tidy/include
|
|
${PUGIXML_INCLUDE_DIR}
|
|
lib/curlcpp/include
|
|
${Boost_INCLUDE_DIRS}
|
|
)
|
|
include_directories(
|
|
src/
|
|
"${PROJECT_BINARY_DIR}"
|
|
)
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
src/main.cpp
|
|
src/htmlretrieve.cpp
|
|
)
|
|
|
|
if (BUILD_SHARED_TIDY)
|
|
set(TIDY_LIB "tidy-share")
|
|
else(BUILD_SHARED_TIDY)
|
|
set(TIDY_LIB "tidy-static")
|
|
endif(BUILD_SHARED_TIDY)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
${TIDY_LIB}
|
|
${PUGIXML_LIBRARIES}
|
|
curlcpp
|
|
${Boost_LIBRARIES}
|
|
)
|
|
|
|
#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)
|
|
unset(PROJECT_VERSION)
|
|
set(BUILD_SHARED_LIB ${BUILD_SHARED_TIDY}) #for tidy
|
|
add_subdirectory(lib/tidy)
|
|
add_subdirectory(lib/curlcpp)
|