Skip to content

Commit db28374

Browse files
vr009Totktonada
authored andcommitted
rocks: unable to install with tarantoolctl rocks on Linux
On any platforms many targets from subdirectories are included into make command by default. They are not necessary to build driver.{so|dylib}. EXCLUDE_FROM_ALL option disables all targets at the beginning and only targets which are explicitly added to mqtt dependencies will be built. Static build option for libmosquitto set by default in rocks. That means there is no more need to install libmosquitto manually for successful build from rocks. But there is still an opportunity to add some other build options in CMake, if it is needed. WITH_PIC added as an option. This is related to the CMP0077 policy. https://cmake.org/cmake/help/latest/policy/CMP0077.html. Without this change the behaviour is the following. If the module builds statically, WITH_PIC is firstly set on, but the effect of this will be discarded by option(WITH_PIC <...> OFF) in third_party/mosquitto/lib/CMakeLists.txt. This way the build fails. Fixes #39
1 parent 794dc18 commit db28374

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

mqtt-scm-1.rockspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ build = {
1818
CMAKE_BUILD_TYPE="RelWithDebInfo";
1919
TARANTOOL_INSTALL_LIBDIR="$(LIBDIR)";
2020
TARANTOOL_INSTALL_LUADIR="$(LUADIR)";
21-
STATIC_BUILD="$(STATIC_BUILD)";
21+
STATIC_BUILD="ON";
2222
};
2323
platforms = {
2424
macosx = {

mqtt/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
option(DOCUMENTATION "Build documentation?" OFF)
55

66
option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" OFF)
7+
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" OFF)
78

89
if( STATIC_BUILD )
910
set(WITH_STATIC_LIBRARIES ON)
@@ -20,7 +21,7 @@ add_library(driver SHARED driver.c)
2021

2122
if( DEFINED STATIC_BUILD )
2223
set(CMAKE_C_FLAGS "-ldl -lpthread")
23-
add_subdirectory(../third_party/mosquitto ../third_party/mosquitto/build)
24+
add_subdirectory(../third_party/mosquitto ../third_party/mosquitto/build EXCLUDE_FROM_ALL)
2425
include_directories(../third_party/mosquitto/lib)
2526
if( STATIC_BUILD )
2627
target_link_libraries(driver libmosquitto_static ${LDFLAGS_EX})

0 commit comments

Comments
 (0)