Commit Graph

128 Commits (dae10733604fffc01245802a5da7e2f8222b5de1)

Author SHA1 Message Date
Roger A. Light 87cb3250cd Set C99 as the explicit, not implicit, build standard. 3 years ago
Roger A. Light fd68bf00c7 Merge branch 'master' into develop 3 years ago
Roger A. Light 966601f6b6 Bump version, new web post 3 years ago
Kai Buschulte 47d6530ddf Enable CMake LTO/IPO support (WITH_LTO option)
Makefiles already support an option to enable link time optimizations.
This is now also possible in CMake by using the WITH_LTO option.
It's turned on by default if the compiler supports these flags.
Note: LTO is part of the inter-procedural optimization (IPO).

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Roger A. Light 8d611a59ab Windows build fix. 3 years ago
Kai Buschulte 71456077ad Introduce a common-options cmake target
this makes it possible to explicitly share compile options, without
using the `add_definition` function. This function declares options for
the current directory and below (in our case also for `deps`).

Adding -Wall, -Wconversion and -Wextra to at least make compiler
warnings visible for the cmake build.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Roger Light a3d94359f9
Merge pull request #2581 from buschulte/cmake-with-test-option
Introduce a CMake WITH_TESTS option
3 years ago
Kai Buschulte 5b02490fd2 Introduce a CMake WITH_TESTS option
To enable or disable tests in the build step and to circumvent the
CUnit build dependency.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte d66702ba37 Fix CMake build for versions <3.19
CMake <3.19 does not support interface targets with sources.
For better IDE integrations we still can add the config.h using the
`target_sources` command.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte a883bda9c1 Add CMake test target
Use `ctest` or `make test` to run all tests.
With this it's also possible to run tests on a Mac.

Relative paths used in tests become absolute ones to make tests
executable from any build folder.

Also fixed race condition in
  test/broker/11-persistent-subscription-no-local.py

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte 8b5a86fd52 Introduce config-header cmake target
This is an interface cmake target which specifies include directories
required by the config.h places in the root of the project.

This header is a "public" header visible to plugins linking the
mosquitto exports.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Roger A. Light 51f9a76f03 Merge branch 'macos-cmake-build' of https://github.com/buschulte/mosquitto into buschulte-macos-cmake-build 3 years ago
Kai Buschulte 7e4746aac4 Fix missing symbols MacOS
Core symbols needed by plugins are now properly linked to their objects

 * Remove link_directories() call:

This specification is not necessary for our own libraries as cmake
shares this information over the targets.

If needed they should be specified target specific, like done for
the external DLT library.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte 0e9df05d0d Add imported target for cJSON
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Kai Buschulte 15208e55cc Use preinstalled CMake find module for SQLite3
CMake >= 3.14 comes with a preinstalled FindSQLite3 module, which now
replaces the self-written one.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
3 years ago
Pierre Hallot 8504f6b70b
CMake: Use PROJECT_SOURCE_DIR to improve using mosquitto as subdirectory
When mosquitto is included as subdirectory, `CMAKE_SOURCE_DIR` does not refer to the mosquitto top level CMake file, but to the whole project top level CMake.
Use `PROJECT_SOURCE_DIR` instead to refer to the right CMake in both contextes.

Signed-off-by: Pierre Hallot <hallotpierre@gmail.com>
4 years ago
Roger A. Light b922c13509 Compile broker against pthreads if threading enabled.
This allows plugins to *carefully* use threads.
4 years ago
Roger A. Light 7552e944a8 Long overdue bump of in-development version number. 4 years ago
Roger A. Light 74814cc68f Simplify cmake threads detection on Windows
Requires cmake 3.1.
4 years ago
Roger A. Light 49b1d7dfbd Merge branch 'win-threads' of https://github.com/podsvirov/mosquitto into podsvirov-win-threads 4 years ago
Roger A. Light a0f58f20c3 Update threaded builds.
Most specifically use -pthread instead of -lpthread.
4 years ago
Roger A. Light bc1adfd46d CMake fixes.
Builtin websockets support.
Persist sqlite plugin build.
Broker cJSON support
Add wildcard-temp plugin.
4 years ago
Roger A. Light 6b32cf61b2 CMake build fixes, including sqlite support. 4 years ago
Roger A. Light 2a056f14c2 Bump version number, update web. 4 years ago
Konstantin Podsvirov f5fd5cd210 Fix hardcoded pthreads paths on Windows
Use FindThreads module instead if available.

Signed-off-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
4 years ago
Roger A. Light 292e969140 Bump version, update web. 4 years ago
Roger Light 88dfac8e88 Windows threading support for the library. 4 years ago
Roger A. Light aa29b45e70 Merge branch 'master' into develop 4 years ago
Roger A. Light 42acfdad41 Bump version, update web page. 4 years ago
Roger A. Light 49065f03a8 Merge remote-tracking branch 'origin/fixes' into develop 4 years ago
Roger A. Light ea7e2a6bca Bump version, add post. 4 years ago
Roger Light 0a90e62f93 CMake tidy. 4 years ago
Roger Light ef7662ca8e Merge branch 'master' into develop 4 years ago
Roger A. Light e7aa0fed2f Bump version, update web page. 5 years ago
Roger A. Light bb73eed557 Bump version number and update web pages. 5 years ago
Roger A. Light fd036b9435 Merge branch 'fixes' into develop 5 years ago
Roger A. Light abc288a435 Experimental kqueue support. 5 years ago
Roger A. Light cec9d36445 Bump version and web pages. 5 years ago
Roger A. Light c2a26250f6 Bump changelog, versions, and web pages. 5 years ago
Roger A. Light bbe0afbfbe Add missing WITH_CJSON option. 5 years ago
Roger A. Light 53b7cc5fc1 Bump version number, add web post. 5 years ago
Boris Feinstein c16514ca23 perform cjson discovery only if WITH_CJSON=ON
When using cmake to build the project, cJson discovery
should only be performed if WITH_CJSON=ON.

Closes #2026.

Signed-off-by: Boris Feinstein <madhat1@gmail.com>
5 years ago
Roger A. Light ae3800ad66 Bump version number, add www post. 5 years ago
Roger A. Light 5a565da82b Bump version number. Update changelog and web pages. 5 years ago
Roger A. Light d02bc03ed8 Bump version, changelog and webpage. 5 years ago
Pierre Hallot 57d2818a3d
Fix appending CMake module path to existing path
The code would simply append the folder with no separator, resulting in an invalid path if the variable was not empty.
Now properly append it.

Signed-off-by: Pierre Hallot <hallotpierre@gmail.com>
5 years ago
Pierre Hallot ddb0f21ab5
Set cmake_minimum_required first as recommended in the documentation
https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html
"Note Call the cmake_minimum_required() command at the beginning of the top-level CMakeLists.txt file even before calling the project() command. It is important to establish version and policy settings before invoking other commands whose behavior they may affect."

Signed-off-by: Pierre Hallot <hallotpierre@gmail.com>
5 years ago
Pierre Hallot 4dcfe5424f
Remove CMAKE_LEGACY_CYGWIN_WIN32 which is not needed anymore
According to this from the mailing list, it is no longer required since the minimum cmake required is 3.0.

https://cmake.org/pipermail/cmake/2014-July/058048.html
"The code that emits the warning is run by "project()". Since you do not have an explicit project() call in your top-level CMakeLists.txt CMake adds one to the top implicitly. [1]
A project file that explicitly calls project() after requiring CMake >= 2.8.4 should make the warning go away."

Signed-off-by: Pierre Hallot <hallotpierre@gmail.com>
5 years ago
Roger A. Light cc47eaba09 Bump version number and update webpage. 5 years ago
Roger A. Light 66b680af34 Bump version number. 5 years ago