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>
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>
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>
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>
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>
Some client/app code also optionally use cJSON, however it won't be found if plugins are disabled.
Signed-off-by: Pierre Hallot <hallotpierre@gmail.com>
libmosquitto.pc and libmosquittopp.pc contain arch dependent information.
The Makefile based build already does this correctly.
Signed-off-by: Timo Gurr <timo.gurr@gmail.com>