Once again, the root CMakeLists.txt file is unchanged with respect to the previous recipe. Moving onto the leaf directory src containing our sources:
- We need to find the UUID library and we can re-use the code used in previous recipes:
# Search for pkg-config and UUIDfind_package(PkgConfig QUIET)if(PKG_CONFIG_FOUND) pkg_search_module(UUID uuid IMPORTED_TARGET) if(TARGET PkgConfig::UUID) message(STATUS "Found libuuid") set(UUID_FOUND TRUE) endif()endif()
- Next, we set up our shared library target and generate the export header, as shown in the previous recipe:
add_library(message-shared SHARED "")include(GenerateExportHeader)generate_export_header(message-shared BASE_NAME "message" EXPORT_MACRO_NAME "message_EXPORT" EXPORT_FILE_NAME ...