Updated macros to search for boost, curl and openssl libraries
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 21 Sep 2009 10:19:14 +0000 (12:19 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 21 Sep 2009 10:19:23 +0000 (12:19 +0200)
CMakeLists.txt
src/CMakeLists.txt

index 92a6020..b5a65bb 100644 (file)
@@ -9,51 +9,3 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
 ADD_DEFINITIONS(-Wall -O2)
 
 add_subdirectory(src)
-
-# find boost_program_options
-FIND_LIBRARY( BOOST_PROGRAM_OPTIONS libboost_program_options.so )
-IF(BOOST_PROGRAM_OPTIONS)
-    MESSAGE(STATUS "Found boost/program_options as ${BOOST_PROGRAM_OPTIONS}")
-ELSE(BOOST_PROGRAM_OPTIONS)
-    MESSAGE(FATAL_ERROR "Could not find boost/program_options")
-ENDIF(BOOST_PROGRAM_OPTIONS)
-
-# find boost_filesystem
-FIND_LIBRARY( BOOST_FILESYSTEM libboost_filesystem.so )
-IF(BOOST_FILESYSTEM)
-    MESSAGE(STATUS "Found boost/filesystem as ${BOOST_FILESYSTEM}")
-ELSE(BOOST_FILESYSTEM)
-    MESSAGE(FATAL_ERROR "Could not find boost/filesystem")
-ENDIF(BOOST_FILESYSTEM)
-
-# find boost_regex
-FIND_LIBRARY( BOOST_REGEX libboost_regex.so )
-IF(BOOST_REGEX)
-    MESSAGE(STATUS "Found boost/regex as ${BOOST_REGEX}")
-ELSE(BOOST_REGEX)
-    MESSAGE(FATAL_ERROR "Could not find boost/regex")
-ENDIF(BOOST_REGEX)
-
-# find boost_serialization
-FIND_LIBRARY( BOOST_SERIALIZATION libboost_serialization.so )
-IF(BOOST_SERIALIZATION)
-    MESSAGE(STATUS "Found boost/serialization as ${BOOST_SERIALIZATION}")
-ELSE(BOOST_SERIALIZATION)
-    MESSAGE(FATAL_ERROR "Could not find boost/serialization")
-ENDIF(BOOST_SERIALIZATION)
-
-# find curl
-FIND_LIBRARY( CURL libcurl.so )
-IF(CURL)
-    MESSAGE(STATUS "Found CURL as ${CURL}")
-ELSE(CURL)
-    MESSAGE(FATAL_ERROR "Could not find CURL")
-ENDIF(CURL)
-
-# find libcrypto
-FIND_LIBRARY( CRYPTO libcrypto.so )
-IF(CRYPTO)
-    MESSAGE(STATUS "Found libcrypto as ${CRYPTO}")
-ELSE(CRYPTO)
-    MESSAGE(FATAL_ERROR "Could not find libcrypto")
-ENDIF(CRYPTO)
index e131190..45cd5e6 100644 (file)
@@ -1,5 +1,17 @@
+# Find Boost
+find_package(Boost COMPONENTS program_options filesystem regex serialization REQUIRED)
+
+# Find CURL
+find_package(CURL)
+
+# Find OpenSSL (libcrypto)
+find_package(OpenSSL)
+
 # Includes
-include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src )
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
+                                   ${CURL_INCLUDES}
+                                   ${OPENSSL_INCLUDES}
+                                )
 
 # C++ sources
 set(cpp_sources
@@ -25,6 +37,7 @@ set(cpp_sources
         util.cpp
     )
 
+# C++ headers
 set(cpp_headers
         config.h
         httphelper.h
@@ -51,7 +64,7 @@ set(cpp_headers
 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})
 
 # Install
 install(TARGETS bpdyndnsd DESTINATION bin)