[osmium-tool] 29/97: Extra checks for missing libraries.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Tue Jul 21 20:15:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to tag v1.0.0
in repository osmium-tool.

commit 3e87a7b01db099588767484c89d3d2cee18a4694
Author: Jochen Topf <jochen at topf.org>
Date:   Tue Jul 29 14:58:03 2014 +0200

    Extra checks for missing libraries.
    
    Turns out the cmake REQUIRED parameter to find_package() doesn't actually check
    that the package is available. So we have to do it "manually".
---
 CMakeLists.txt         | 45 +++++++++++++++++++++++++++++++++++++++++++++
 cmake/FindOsmium.cmake |  1 +
 2 files changed, 46 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5078bc..4a60286 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,41 +30,86 @@ set(OSMIUM_VERSION ${OSMIUM_VERSION_MAJOR}.${OSMIUM_VERSION_MINOR}.${OSMIUM_VERS
 #----------------------------------------------------------------------
 find_package(Threads REQUIRED)
 list(APPEND LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+if(NOT THREADS_FOUND)
+    message(WARNING "Threads library not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(ZLIB REQUIRED)
 include_directories(${ZLIB_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${ZLIB_LIBRARIES})
+if(NOT ZLIB_FOUND)
+    message(WARNING "Zlib not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(BZip2 REQUIRED)
 include_directories(${BZIP2_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${BZIP2_LIBRARIES})
+if(NOT BZIP2_FOUND)
+    message(WARNING "BZip2 library not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(EXPAT REQUIRED)
 include_directories(${EXPAT_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${EXPAT_LIBRARIES})
+if(NOT EXPAT_FOUND)
+    message(WARNING "Expat library not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(Protobuf REQUIRED)
 include_directories(${PROTOBUF_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${PROTOBUF_LITE_LIBRARIES})
+if(NOT PROTOBUF_FOUND)
+    message(WARNING "Protobuf library not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(Boost COMPONENTS program_options REQUIRED)
 include_directories(${BOOST_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${Boost_LIBRARIES})
+if(NOT Boost_FOUND)
+    message(WARNING "Boost program_options not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(Cryptopp REQUIRED)
 include_directories(${CRYPTOPP_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${CRYPTOPP_LIBRARIES})
+if(NOT CRYPTOPP_FOUND)
+    message(WARNING "Crypto++/Cryptopp library not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(OSMPBF REQUIRED)
 include_directories(${OSMPBF_INCLUDE_DIRS})
 list(APPEND LIBRARIES ${OSMPBF_LIBRARIES})
+if(NOT OSMPBF_FOUND)
+    message(WARNING "OSMPBF library not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 find_package(Osmium REQUIRED)
 include_directories(${OSMIUM_INCLUDE_DIRS})
+if(NOT OSMIUM_FOUND)
+    message(WARNING "Libosmium not found!\n")
+    set(MISSING_LIB 1)
+endif()
 
 
 #----------------------------------------------------------------------
 #
+#  Check that all required libraries are available
+#
+#----------------------------------------------------------------------
+if(MISSING_LIB)
+    message(FATAL_ERROR "Required library or libraries missing. Aborting...")
+endif(MISSING_LIB)
+
+#----------------------------------------------------------------------
+#
 #  Optional "cppcheck" target that checks C++ code
 #
 #----------------------------------------------------------------------
diff --git a/cmake/FindOsmium.cmake b/cmake/FindOsmium.cmake
index 07a1a93..6f49169 100644
--- a/cmake/FindOsmium.cmake
+++ b/cmake/FindOsmium.cmake
@@ -9,6 +9,7 @@ find_path(OSMIUM_INCLUDE_DIR osmium/osm.hpp
     PATH_SUFFIXES include
     PATHS
     ../libosmium
+    libosmium
     ~/Library/Frameworks
     /Library/Frameworks
     /usr/local

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmium-tool.git



More information about the Pkg-grass-devel mailing list