Skip to content

Compilation takes a long time #910

@nandlab

Description

@nandlab

Hello,

building a program with MQTT_CPP takes very long. I am adding mqtt_cpp as a git submodule.
The following example program takes 35 (!) seconds to compile on my linux machine:

#include <iostream>
#include "mqtt_client_cpp.hpp"

using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

This is my CMake file:

cmake_minimum_required(VERSION 3.5)

project(MqttCppTestInclusion LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(MqttCppTestInclusion main.cpp)
set(MQTT_CPP_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/mqtt_cpp/include")
include_directories(${CMAKE_SOURCE_DIR} ${MQTT_CPP_INCLUDE})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(Boost REQUIRED system)
target_link_libraries(MqttCppTestInclusion PRIVATE Threads::Threads Boost::system)
target_link_libraries(MqttCppTestInclusion LINK_PUBLIC)

Even if I make a small change somewhere which is not related to MQTT, it always takes the same time to recompile.

Is there a way to compile programs with mqtt_cpp more efficiently?

Could maybe separating the function declarations and definitions in mqtt_cpp into separate files increase the incremental build speed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions