<commit_before>##
## Project:   retdec-cpp
## Copyright: (c) 2015 by <NAME> <<EMAIL>>
## License:   MIT, see the LICENSE file for more details
##
## The project's main CMake configuration file.
##

cmake_minimum_required(VERSION 2.8)

project(retdec-cpp CXX C)

##
## Options.
##

option(RETDEC_DOC "Build public API documentation (requires Doxygen)." OFF)
option(RETDEC_INTERNAL_DOC "Build also the internal parts of the API documentation." OFF)
option(RETDEC_TOOLS "Build tools." OFF)
option(RETDEC_COVERAGE "Build with code coverage support (requires GCC and lcov)." OFF)
option(RETDEC_TESTS "Build tests." OFF)

if(${RETDEC_INTERNAL_DOC})
	set(RETDEC_DOC ON)
endif()

if(${RETDEC_COVERAGE})
	set(RETDEC_TESTS ON)

	# The coverage currently works only for GCC builds.
	if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
		message(FATAL_ERROR "Code coverage support requires GCC to be used.")
	endif()
endif()

##
## Paths.
##

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE PATH "default install path" FORCE)
endif()
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin")
set(INSTALL_DOC_DIR "${CMAKE_INSTALL_PREFIX}/doc")
set(INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(INSTALL_LIB_CMAKE_DIR "${INSTALL_LIB_DIR}/cmake")

##
## Dependencies.
##

include(ExternalProject)

# The default root directory for external projects.
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party)

# Threads
find_package(Threads REQUIRED)

# Boost
find_package(Boost 1.55 COMPONENTS "filesystem" "system" "thread" REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

# OpenSSL
find_package(OpenSSL REQUIRED)
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIRS})

# cpp-netlib
find_package(CPP-NETLIB COMPONENTS "uri" "client-connections")
if(NOT CPP-NETLIB_FOUND)
	ExternalProject_Add(cpp-netlib
		URL http://downloads.cpp-netlib.org/0.11.2/cpp-netlib-0.11.2-final.zip
		CMAKE_ARGS
			-DCPP-NETLIB_BUILD_TESTS:BOOL=OFF
			-DCPP-NETLIB_BUILD_EXAMPLES:BOOL=OFF
		INSTALL_COMMAND ""
		# Wrap the download, configure and build steps in a script to log the
		# output.
		LOG_DOWNLOAD ON
		LOG_CONFIGURE ON
		LOG_BUILD ON
	)
	ExternalProject_Get_Property(cpp-netlib source_dir)
	ExternalProject_Get_Property(cpp-netlib binary_dir)
	set(CPP-NETLIB_INCLUDE_DIR "${source_dir}")
	set(CPP-NETLIB_LIBRARY_DIR "${binary_dir}/libs/network/src")
	set(CPP-NETLIB_LIBRARIES "cppnetlib-uri" "cppnetlib-client-connections")
	link_directories(${CPP-NETLIB_LIBRARY_DIR})
endif()
include_directories(SYSTEM ${CPP-NETLIB_INCLUDE_DIR})
# Enable HTTPS. The following symbol has to be defined prior to including
# cpp-netlib headers.
add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS)

# json-cpp
find_package(JsonCpp)
if(NOT JsonCpp_FOUND)
	ExternalProject_Add(json-cpp
		URL https://github.com/open-source-parsers/jsoncpp/archive/1.6.5.zip<commit_msg>Comment INSTALL_COMMAND "" in external projects.<commit_after>##
## Project:   retdec-cpp
## Copyright: (c) 2015 by Petr Zemek <<EMAIL>>
## License:   MIT, see the LICENSE file for more details
##
## The project's main CMake configuration file.
##

cmake_minimum_required(VERSION 2.8)

project(retdec-cpp CXX C)

##
## Options.
##

option(RETDEC_DOC "Build public API documentation (requires Doxygen)." OFF)
option(RETDEC_INTERNAL_DOC "Build also the internal parts of the API documentation." OFF)
option(RETDEC_TOOLS "Build tools." OFF)
option(RETDEC_COVERAGE "Build with code coverage support (requires GCC and lcov)." OFF)
option(RETDEC_TESTS "Build tests." OFF)

if(${RETDEC_INTERNAL_DOC})
	set(RETDEC_DOC ON)
endif()

if(${RETDEC_COVERAGE})
	set(RETDEC_TESTS ON)

	# The coverage currently works only for GCC builds.
	if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
		message(FATAL_ERROR "Code coverage support requires GCC to be used.")
	endif()
endif()

##
## Paths.
##

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE PATH "default install path" FORCE)
endif()
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin")
set(INSTALL_DOC_DIR "${CMAKE_INSTALL_PREFIX}/doc")
set(INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(INSTALL_LIB_CMAKE_DIR "${INSTALL_LIB_DIR}/cmake")

##
## Dependencies.
##

include(ExternalProject)

# The default root directory for external projects.
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/third_party)

# Threads
find_package(Threads REQUIRED)

# Boost
find_package(Boost 1.55 COMPONENTS "filesystem" "system" "thread" REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})

# OpenSSL
find_package(OpenSSL REQUIRED)
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIRS})

# cpp-netlib
find_package(CPP-NETLIB COMPONENTS "uri" "client-connections")
if(NOT CPP-NETLIB_FOUND)
	ExternalProject_Add(cpp-netlib
		URL http://downloads.cpp-netlib.org/0.11.2/cpp-netlib-0.11.2-final.zip
		CMAKE_ARGS
			-DCPP-NETLIB_BUILD_TESTS:BOOL=OFF
			-DCPP-NETLIB_BUILD_EXAMPLES:BOOL=OFF
		# Disable the install step.
		INSTALL_COMMAND ""
		# Wrap the download, configure and build steps in a script to log the
		# output.
		LOG_DOWNLOAD ON
		LOG_CONFIGURE ON
		LOG_BUILD ON
	)
	ExternalProject_Get_Property(cpp-netlib source_dir)
	ExternalProject_Get_Property(cpp-netlib binary_dir)
	set(CPP-NETLIB_INCLUDE_DIR "${source_dir}")
	set(CPP-NETLIB_LIBRARY_DIR "${binary_dir}/libs/network/src")
	set(CPP-NETLIB_LIBRARIES "cppnetlib-uri" "cppnetlib-client-connections")
	link_directories(${CPP-NETLIB_LIBRARY_DIR})
endif()
include_directories(SYSTEM ${CPP-NETLIB_INCLUDE_DIR})
# Enable HTTPS. The following symbol has to be defined prior to including
# cpp-netlib headers.
add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS)

# json-cpp
find_package(JsonCpp)
if(NOT JsonCpp_FOUND)
	ExternalProject_Add(json-cpp
		URL https://github.com/open-source-parsers/jsoncpp/archive/1.6.5.zip
		# Disable the install step.
{'fraction_non_alphanumeric': 0.112445237708908, 'fraction_numerical': 0.0064903456109037805, 'mean_word_length': 6.572481572481572, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1300146', 'n_tokens_mistral': 2342, 'n_tokens_neox': 2160, 'n_words': 458}