Small corrections to Libt2n.cmake - linking the boost serialization library to the...
authorKristóf Katus <kristof.katus@intra2net.com>
Fri, 26 Aug 2011 09:37:10 +0000 (11:37 +0200)
committerKristóf Katus <kristof.katus@intra2net.com>
Fri, 26 Aug 2011 09:37:10 +0000 (11:37 +0200)
codegen/Libt2n.cmake
examples-codegen/cmake/CMakeLists.txt

index a31edee..f547fe9 100644 (file)
@@ -1,8 +1,14 @@
-# Detect libt2n. Version of this file: 1.2
+# Version of this file: 1.3
+
+# Detect libt2n
 pkg_check_modules(LIBT2N REQUIRED libt2n)
 include_directories(${LIBT2N_INCLUDE_DIRS})
 link_directories(${LIBT2N_LIBRARY_DIRS})
 
+# Detect the boost serialization library
+find_package(Boost 1.34 COMPONENTS serialization REQUIRED)
+include_directories(${Boost_INCLUDE_DIRS})
+
 # Get locations from pkgconfig
 execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable libt2n_codegen libt2n
                                 OUTPUT_VARIABLE LIBT2N_CODEGEN
@@ -87,11 +93,13 @@ function(setup_libt2n)
         # Create shared client library
         add_library(${CMDGROUP} SHARED ${CMDGROUP}_client.cpp ${CMDGROUP}_client.hxx)
         set_target_properties(${CMDGROUP} PROPERTIES VERSION ${VERSION} SOVERSION 1)
+       target_link_libraries(${CMDGROUP} ${Boost_SERIALIZATION_LIBRARIES})
         install(TARGETS ${CMDGROUP} LIBRARY DESTINATION lib COMPONENT sharedlibs)
 
         # Create static client library
         add_library(${CMDGROUP}-static STATIC ${CMDGROUP}_client.cpp ${CMDGROUP}_client.hxx)
         set_target_properties(${CMDGROUP}-static PROPERTIES OUTPUT_NAME "${CMDGROUP}")
+       target_link_libraries(${CMDGROUP}-static ${Boost_SERIALIZATION_LIBRARIES})
         install(TARGETS ${CMDGROUP}-static ARCHIVE DESTINATION lib COMPONENT staticlibs)
 
         # Prevent clobbering each other during the build
index 60bb8d1..8ed2c7e 100644 (file)
@@ -6,11 +6,12 @@ set(t2n_mydaemon_GROUP
     ${CMAKE_SOURCE_DIR}/src/t2n_mydaemon.cpp
 )
 include(${CMAKE_SOURCE_DIR}/codegen/Libt2n.cmake)
+# Or "include(Libt2n)" if Libt2n.cmake is already installed in /${CMAKE_ROOT}/Modules
 
 # Call setup_libt2n with the CMDGROUP name
 setup_libt2n(t2n_mydaemon)
 
-# ------------------------------------------------------------------------------------------------------
+# --------------------------------------------------------------------------------
 
 set(keymaker_cpp_sources
     something.cpp