Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] Using cmake on linux for 1.4

I've noticed two problems compiling the new 1.4 on linux using cmake. Both problems are seen on Slackware64 and Ubuntu 14.04.

1. src/CMakeLists.txt incorrectly (I believe) uses the "exported_symbols_list" linker option. Linking fails with that option in place. I think this should use "dynamic-list" option instead as shown in the attached patch. Linking completes with this patch.

2. CMakeLists.txt contains the directive cmake_policy(SET CMP0042 NEW) immediately following cmake_minimum_required(VERSION 2.8). However, using cmake-2.8.12 I see the error:
    CMake Error at CMakeLists.txt:12 (cmake_policy):
        Policy "CMP0042" is not known to this version of CMake.

The documentation at indicates that it was introduced in cmake-3.0 i.e. not applicable to previous versions.

It can be fixed locally (cmake-2.8.12) by commenting that line out or making it conditional, as per second attached patch.

--- src/CMakeLists.txt.orig	2015-02-18 11:44:09.000000000 +1000
+++ src/CMakeLists.txt	2015-02-21 14:24:10.423277309 +1000
@@ -113,7 +113,7 @@
 	if (APPLE)
 		set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker-macosx.syms")
 	else (APPLE)
-		set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-exported_symbols_list -Wl,${mosquitto_SOURCE_DIR}/src/linker.syms")
+		set_target_properties(mosquitto PROPERTIES LINK_FLAGS "-Wl,-dynamic-list -Wl,${mosquitto_SOURCE_DIR}/src/linker.syms")
 	endif (APPLE)
 endif (UNIX)
--- CMakeLists.txt.orig	2015-02-18 11:44:09.000000000 +1000
+++ CMakeLists.txt	2015-02-21 15:47:09.171321949 +1000
@@ -9,7 +9,9 @@
 cmake_minimum_required(VERSION 2.8)
-cmake_policy(SET CMP0042 NEW)
+if (POLICY CMP0042)
+	cmake_policy(SET CMP0042 NEW)
+endif (POLICY CMP0042)
 set (VERSION 1.4)

Back to the top