@@ -104,24 +104,6 @@ if (NOT CPPKAFKA_PKGCONFIG_DIR)
104104 set (CPPKAFKA_PKGCONFIG_DIR share/pkgconfig)
105105endif ()
106106
107- # Look for Boost (just need boost.optional headers here)
108- find_package (Boost REQUIRED ${FIND_PACKAGE_QUIET} )
109-
110- if (Boost_FOUND)
111- find_package (Boost COMPONENTS program_options ${FIND_PACKAGE_QUIET} )
112- set (Boost_USE_STATIC_LIBS ${CPPKAFKA_BOOST_STATIC_LIBS} )
113- set (Boost_USE_MULTITHREADED ${CPPKAFKA_BOOST_USE_MULTITHREADED} )
114- include_directories (${Boost_INCLUDE_DIRS} )
115- link_directories (${Boost_LIBRARY_DIRS} )
116- if (CPPKAFKA_CMAKE_VERBOSE)
117- message (STATUS "Boost include dir: ${Boost_INCLUDE_DIRS} " )
118- message (STATUS "Boost library dir: ${Boost_LIBRARY_DIRS} " )
119- message (STATUS "Boost use static libs: ${Boost_USE_STATIC_LIBS} " )
120- message (STATUS "Boost is multi-threaded: ${CPPKAFKA_BOOST_USE_MULTITHREADED} " )
121- message (STATUS "Boost libraries: ${Boost_LIBRARIES} " )
122- endif ()
123- endif ()
124-
125107# Try to find the RdKafka configuration file if present.
126108# This will search default system locations as well as RdKafka_ROOT and RdKafka_Dir paths if specified.
127109find_package (RdKafka ${FIND_PACKAGE_QUIET} CONFIG)
@@ -142,10 +124,28 @@ add_subdirectory(src)
142124add_subdirectory (include /cppkafka)
143125
144126# Examples target
145- if (NOT CPPKAFKA_DISABLE_EXAMPLES AND Boost_PROGRAM_OPTIONS_FOUND)
146- add_subdirectory (examples)
147- else ()
148- message (STATUS "Disabling examples" )
127+ if (NOT CPPKAFKA_DISABLE_EXAMPLES)
128+ # Look for Boost (just need boost.optional headers here)
129+ find_package (Boost ${FIND_PACKAGE_QUIET} CONFIG)
130+ if (Boost_FOUND)
131+ option (CPPKAFKA_BOOST_STATIC_LIBS "Link with Boost static libraries." ON )
132+ option (CPPKAFKA_BOOST_USE_MULTITHREADED "Use Boost multithreaded libraries." ON )
133+ find_package (Boost COMPONENTS program_options ${FIND_PACKAGE_QUIET} )
134+ set (Boost_USE_STATIC_LIBS ${CPPKAFKA_BOOST_STATIC_LIBS} )
135+ set (Boost_USE_MULTITHREADED ${CPPKAFKA_BOOST_USE_MULTITHREADED} )
136+ include_directories (${Boost_INCLUDE_DIRS} )
137+ link_directories (${Boost_LIBRARY_DIRS} )
138+ if (CPPKAFKA_CMAKE_VERBOSE)
139+ message (STATUS "Boost include dir: ${Boost_INCLUDE_DIRS} " )
140+ message (STATUS "Boost library dir: ${Boost_LIBRARY_DIRS} " )
141+ message (STATUS "Boost use static libs: ${Boost_USE_STATIC_LIBS} " )
142+ message (STATUS "Boost is multi-threaded: ${CPPKAFKA_BOOST_USE_MULTITHREADED} " )
143+ message (STATUS "Boost libraries: ${Boost_LIBRARIES} " )
144+ endif ()
145+ add_subdirectory (examples)
146+ else ()
147+ message (STATUS "Disabling examples" )
148+ endif ()
149149endif ()
150150
151151# Add a target to generate API documentation using Doxygen
0 commit comments