You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/06/19 13:52:11 UTC

[qpid-cpp] 03/10: QPID-8324: Fix CMake based warnings - Up minium CMake version not on Windows - Fix some policy settings - More correctly use target_link_libraries

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git

commit 502d0f3a018fe97e2a62aa7dbe827a0c9690bbcf
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Jun 14 02:08:44 2019 -0400

    QPID-8324: Fix CMake based warnings
    - Up minium CMake version not on Windows
    - Fix some policy settings
    - More correctly use target_link_libraries
---
 CMakeLists.txt          | 13 +++----------
 bindings/CMakeLists.txt |  6 ++++++
 src/CMakeLists.txt      | 21 +++++++++++++--------
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 807517e..6423b6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@
 project(qpid-cpp)
 
 if (NOT MSVC)
-  cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
+  cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
 else (NOT MSVC)
   # windows PDB file installation needs v3.1
   cmake_minimum_required(VERSION 3.1.3 FATAL_ERROR)
@@ -33,7 +33,7 @@ else (CMAKE_CONFIGURATION_TYPES)
   # There is a single build configuration
   # If the build type is not set then set the default
   if (NOT CMAKE_BUILD_TYPE)
-  set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE string
+  set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
        "Build type: Debug, Release, RelWithDebInfo or MinSizeRel (default RelWithDebInfo)" FORCE)
   endif ()
 
@@ -130,14 +130,6 @@ add_custom_target(uninstall
 # Define windows versions and library helpers
 include (src/msvc.cmake)
 
-# Do not keep on linking against transitive library dependencies
-# TODO Need to rework CMake files to use INTERFACE_LINK_LIBRARIES target property
-# When that is done we can remove the next 4 lines completely
-set (CMAKE_LINK_INTERFACE_LIBRARIES "")
-if (DEFINED CMAKE_VERSION AND NOT CMAKE_VERSION VERSION_LESS "2.8.12")
-  cmake_policy(SET CMP0022 OLD)
-endif (DEFINED CMAKE_VERSION AND NOT CMAKE_VERSION VERSION_LESS "2.8.12")
-
 if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
   # Warnings: Enable as many as possible, keep the code clean. Please
   # do not disable warnings or remove -Werror without discussing on
@@ -162,6 +154,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
   if (CMAKE_SYSTEM_NAME STREQUAL SunOS)
     set (CATCH_UNDEFINED "")
   endif (CMAKE_SYSTEM_NAME STREQUAL SunOS)
+
   set (NOSTRICT_ALIASING "-fno-strict-aliasing")
   set (COMPILER_FLAGS "-fvisibility-inlines-hidden")
   # gcc 4.1.2 on RHEL 5 needs -Wno-attributes to avoid an error that's fixed
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 28e836a..48c6e3d 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -45,6 +45,12 @@ endmacro(find_python_libs)
 find_package(SWIG)
 if (SWIG_FOUND)
 
+  if (POLICY CMP0078)
+    cmake_policy(SET CMP0078 OLD)
+  endif()
+  if (POLICY CMP0086)
+    cmake_policy(SET CMP0086 OLD)
+  endif()
   include(UseSWIG)
   find_package(Ruby)
   find_python_libs()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d3aad73..fe63090 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -492,7 +492,7 @@ if (BUILD_XML)
                qpid/xml/XmlExchange.cpp
                qpid/xml/XmlExchange.h
                qpid/xml/XmlExchangePlugin.cpp)
-  target_link_libraries (xml xerces-c xqilla qpidbroker qpidcommon)
+  target_link_libraries (xml PRIVATE xerces-c xqilla qpidbroker qpidcommon)
   set_target_properties (xml PROPERTIES
                          PREFIX "")
   install (TARGETS xml
@@ -575,6 +575,7 @@ if (BUILD_HA)
 
     add_library (ha MODULE ${ha_SOURCES})
     target_link_libraries (ha
+                           PRIVATE
                            qpidtypes qpidcommon qpidbroker qpidmessaging
                            ${Boost_PROGRAM_OPTIONS_LIBRARY})
     set_target_properties (ha PROPERTIES
@@ -847,7 +848,9 @@ add_msvc_version (qpidcommon library dll)
 
 add_library (qpidcommon SHARED ${qpidcommon_SOURCES})
 
-target_link_libraries (qpidcommon qpidtypes
+target_link_libraries (qpidcommon
+                       PRIVATE
+                       qpidtypes
                        ${qpidcommon_platform_LIBS}
                        ${Boost_PROGRAM_OPTIONS_LIBRARY}
                        "${sasl_LIB}"
@@ -876,7 +879,7 @@ set_source_files_properties(
 
 add_msvc_version (qpidtypes library dll)
 add_library(qpidtypes SHARED ${qpidtypes_SOURCES})
-target_link_libraries(qpidtypes "${uuid_LIB}")
+target_link_libraries(qpidtypes PRIVATE "${uuid_LIB}")
 set_target_properties (qpidtypes PROPERTIES
                        LINK_FLAGS "${HIDE_SYMBOL_FLAGS} ${LINK_VERSION_SCRIPT_FLAG}"
                        VERSION ${qpidtypes_version}
@@ -933,7 +936,7 @@ add_msvc_version (qpidclient library dll)
 
 add_library (qpidclient SHARED ${qpidclient_SOURCES})
 
-target_link_libraries (qpidclient qpidcommon qpidtypes
+target_link_libraries (qpidclient PRIVATE qpidcommon qpidtypes
                        ${ssl_LIBS})
 
 set_target_properties (qpidclient PROPERTIES
@@ -1001,7 +1004,7 @@ set (qpidmessaging_SOURCES
 add_msvc_version (qpidmessaging library dll)
 
 add_library (qpidmessaging SHARED ${qpidmessaging_SOURCES})
-target_link_libraries (qpidmessaging qpidtypes qpidclient qpidcommon ${Proton_Core_LIBRARIES})
+target_link_libraries (qpidmessaging PRIVATE qpidtypes qpidclient qpidcommon ${Proton_Core_LIBRARIES})
 set_target_properties (qpidmessaging PROPERTIES
                        LINK_FLAGS "${HIDE_SYMBOL_FLAGS} ${LINK_VERSION_SCRIPT_FLAG}"
                        COMPILE_FLAGS "${HIDE_SYMBOL_FLAGS}"
@@ -1022,7 +1025,7 @@ if (MSVC)
     if (EXISTS ${qpidxarm_SOURCES})
         add_msvc_version (qpidxarm library dll)
         add_library (qpidxarm SHARED ${qpidxarm_SOURCES})
-        target_link_libraries (qpidxarm qpidclient qpidcommon)
+        target_link_libraries (qpidxarm PRIVATE qpidclient qpidcommon)
         install (TARGETS qpidxarm
                  RUNTIME DESTINATION ${QPID_INSTALL_BINDIR} COMPONENT ${QPID_COMPONENT_CLIENT}
                  LIBRARY DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT}
@@ -1134,7 +1137,9 @@ set (qpidbroker_SOURCES
 add_msvc_version (qpidbroker library dll)
 add_library (qpidbroker SHARED ${qpidbroker_SOURCES})
 
-target_link_libraries (qpidbroker qpidcommon qpidtypes
+target_link_libraries (qpidbroker
+                       PRIVATE
+                       qpidcommon qpidtypes
                        "${sasl_LIB}"
                        ${ssl_server_LIBS})
 
@@ -1251,7 +1256,7 @@ endif (NOT WIN32)
 
     add_msvc_version (qmf2 library dll)
     add_library (qmf2 SHARED ${qmf2_SOURCES})
-    target_link_libraries (qmf2 qpidmessaging qpidtypes qpidclient qpidcommon)
+    target_link_libraries (qmf2 PRIVATE qpidmessaging qpidtypes qpidclient qpidcommon)
     set_target_properties (qmf2 PROPERTIES
                            VERSION ${qmf2_version}
                            SOVERSION ${qmf2_version_major})


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org