+# Find Boost
+find_package(Boost COMPONENTS program_options filesystem regex serialization system REQUIRED)
+
+# Find CURL
+find_package(CURL)
+
+# Find OpenSSL (libcrypto)
+find_package(OpenSSL)
+
# Includes
-include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
+include_directories( ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CURL_INCLUDES}
+ ${OPENSSL_INCLUDES}
+ )
+
+configure_file ("${PROJECT_SOURCE_DIR}/src/version_info.h.in" "${PROJECT_BINARY_DIR}/src/version_info.h")
+
+# C++ sources
+set(cpp_sources
+ config.cpp
+ httphelper.cpp
+ ip_addr_helper.cpp
+ logger.cpp
+ main.cpp
+ net_helper.cpp
+ serializeservicecontainer.cpp
+ service.cpp
+ service_dhs.cpp
+ service_dyndns.cpp
+ service_dyns.cpp
+ service_easydns.cpp
+ service_gnudip.cpp
+ service_gnudip_fullhostname.cpp
+ serviceholder.cpp
+ service_ods.cpp
+ service_tzo.cpp
+ service_zoneedit.cpp
+ tcp_service.cpp
+ updater.cpp
+ util.cpp
+ )
+
+# C++ headers
+set(cpp_headers
+ config.hpp
+ httphelper.hpp
+ ip_addr_helper.hpp
+ ip_service.hpp
+ logger.hpp
+ net_helper.hpp
+ serializeservicecontainer.hpp
+ service_dhs.hpp
+ service_dyndns.hpp
+ service_dyns.hpp
+ service_easydns.hpp
+ service_gnudip.hpp
+ service_gnudip_fullhostname.hpp
+ service.hpp
+ serviceholder.hpp
+ service_ods.hpp
+ service_tzo.hpp
+ service_zoneedit.hpp
+ tcp_service.hpp
+ updater.hpp
+ util.hpp
+ version_info.h
+ )
-add_executable(bpdyndnsd main.cpp util.cpp config.cpp logger.cpp service.cpp httphelper.cpp ip_addr_helper.cpp net_helper.cpp serializeservicecontainer.cpp serviceholder.cpp tcp_service.cpp updater.cpp service_dhs.cpp service_dyndns.cpp service_dyns.cpp service_easydns.cpp service_gnudip.cpp service_ods.cpp service_tzo.cpp service_zoneedit.cpp)
+add_executable(bpdyndnsd ${cpp_sources} ${cpp_headers})
# Dependencies
-target_link_libraries(bpdyndnsd ${BOOST_PROGRAM_OPTIONS} ${BOOST_FILESYSTEM} ${BOOST_REGEX} ${BOOST_SERIALIZATION} ${CURL} ${CRYPTO})
+target_link_libraries(bpdyndnsd ${Boost_LIBRARIES} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} pthread)
# Install
install(TARGETS bpdyndnsd DESTINATION bin)