From dd63d047e695d8ee796d79e71c778910457677fe Mon Sep 17 00:00:00 2001
From: Raphael Boucherie <raphael.boucherie@inria.fr>
Date: Mon, 12 Jun 2017 15:01:46 +0200
Subject: [PATCH] fix silent warnings and pkgconfig

---
 CMakeLists.txt                      |  4 +--
 cmake_modules/GenHQRPkgConfig.cmake | 50 ++++++++++++++---------------
 src/treewalk.c                      |  2 +-
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1658f6..2e3abf1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ else()
   set( BUILD_SUBPROJECT ON )
 endif()
 
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
 include(GenHQRPkgConfig)
 
 # The current version number
@@ -66,7 +66,7 @@ install(FILES
 
 install(TARGETS hqr DESTINATION lib)
 
-generate_hqr_pkgconfig_file()
+#generate_hqr_pkgconfig_file()
 
 #-- Add a custom target to generate tags
 add_custom_target (tags
diff --git a/cmake_modules/GenHQRPkgConfig.cmake b/cmake_modules/GenHQRPkgConfig.cmake
index 6335666..b20623e 100644
--- a/cmake_modules/GenHQRPkgConfig.cmake
+++ b/cmake_modules/GenHQRPkgConfig.cmake
@@ -33,18 +33,18 @@
 #                                used in CLEAN_LIB_LIST
 #
 ###
-MACRO(CONVERT_LIBSTYLE_TO_PKGCONFIG _liblist)
+macro(CONVERT_LIBSTYLE_TO_PKGCONFIG _liblist)
     set(${_liblist}_CPY "${${_liblist}}")
     set(${_liblist} "")
     foreach(_dep ${${_liblist}_CPY})
         if (${_dep} MATCHES "^/")
             get_filename_component(dep_libname ${_dep} NAME)
             get_filename_component(dep_libdir  ${_dep} DIRECTORY)
-            STRING(REPLACE "lib"    "" dep_libname "${dep_libname}")
-            STRING(REPLACE ".so"    "" dep_libname "${dep_libname}")
-            STRING(REPLACE ".a"     "" dep_libname "${dep_libname}")
-            STRING(REPLACE ".dylib" "" dep_libname "${dep_libname}")
-            STRING(REPLACE ".dll"   "" dep_libname "${dep_libname}")
+            string(REPLACE "lib"    "" dep_libname "${dep_libname}")
+            string(REPLACE ".so"    "" dep_libname "${dep_libname}")
+            string(REPLACE ".a"     "" dep_libname "${dep_libname}")
+            string(REPLACE ".dylib" "" dep_libname "${dep_libname}")
+            string(REPLACE ".dll"   "" dep_libname "${dep_libname}")
             list(APPEND ${_liblist} -L${dep_libdir} -l${dep_libname})
         elseif(NOT ${_dep} MATCHES "^-")
             list(APPEND ${_liblist} "-l${_dep}")
@@ -52,7 +52,7 @@ MACRO(CONVERT_LIBSTYLE_TO_PKGCONFIG _liblist)
             list(APPEND ${_liblist} ${_dep})
         endif()
     endforeach()
-ENDMACRO(CONVERT_LIBSTYLE_TO_PKGCONFIG)
+endmacro(CONVERT_LIBSTYLE_TO_PKGCONFIG)
 
 ###
 #
@@ -60,44 +60,44 @@ ENDMACRO(CONVERT_LIBSTYLE_TO_PKGCONFIG)
 #                 used in GENERATE_PKGCONFIG_FILE
 #
 ###
-MACRO(CLEAN_LIB_LIST _package)
+macro(CLEAN_LIB_LIST _package)
     list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS)
     list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS_PRIVATE)
     list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED)
     list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED_PRIVATE)
-    CONVERT_LIBSTYLE_TO_PKGCONFIG(${_package}_PKGCONFIG_LIBS)
-    CONVERT_LIBSTYLE_TO_PKGCONFIG(${_package}_PKGCONFIG_LIBS_PRIVATE)
-    STRING(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS "${${_package}_PKGCONFIG_LIBS}")
-    STRING(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS_PRIVATE "${${_package}_PKGCONFIG_LIBS_PRIVATE}")
-    STRING(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED "${${_package}_PKGCONFIG_REQUIRED}")
-    STRING(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED_PRIVATE "${${_package}_PKGCONFIG_REQUIRED_PRIVATE}")
-ENDMACRO(CLEAN_LIB_LIST)
+    convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS)
+    convert_libstyle_to_pkgconfig(${_package}_PKGCONFIG_LIBS_PRIVATE)
+    string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS "${${_package}_PKGCONFIG_LIBS}")
+    string(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS_PRIVATE "${${_package}_PKGCONFIG_LIBS_PRIVATE}")
+    string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED "${${_package}_PKGCONFIG_REQUIRED}")
+    string(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED_PRIVATE "${${_package}_PKGCONFIG_REQUIRED_PRIVATE}")
+endmacro(CLEAN_LIB_LIST)
 
 ###
 #
 # GENERATE_PKGCONFIG_FILE: generate files libhqr.pc
 #
 ###
-MACRO(GENERATE_HQR_PKGCONFIG_FILE)
+macro(GENERATE_HQR_PKGCONFIG_FILE)
 
-  SET(HQR_PKGCONFIG_LIBS "-lhqr")
-  SET(HQR_PKGCONFIG_LIBS_PRIVATE "-lm")
-  SET(HQR_PKGCONFIG_REQUIRED "")
-  SET(HQR_PKGCONFIG_REQUIRED_PRIVATE "")
+  set(HQR_PKGCONFIG_LIBS "-lhqr")
+  set(HQR_PKGCONFIG_LIBS_PRIVATE "-lm")
+  set(HQR_PKGCONFIG_REQUIRED "")
+  set(HQR_PKGCONFIG_REQUIRED_PRIVATE "")
 
-  CLEAN_LIB_LIST(LIBHQR)
+  clean_lib_list(LIBHQR)
 
-  SET(_output_libhqr_file "${CMAKE_BINARY_DIR}/hqr.pc")
-  CONFIGURE_FILE(
+  set(_output_libhqr_file "${CMAKE_BINARY_DIR}/hqr.pc")
+  configure_file(
     "${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/hqr.pc.in"
     "${_output_hqr_file}"
     @ONLY
     )
-  INSTALL(
+  install(
     FILES ${_output_hqr_file}
     DESTINATION lib/pkgconfig
     )
-ENDMACRO(GENERATE_PKGCONFIG_FILE)
+endmacro(GENERATE_HQR_PKGCONFIG_FILE)
 
 ##
 ## @end file GenPkgConfig.cmake
diff --git a/src/treewalk.c b/src/treewalk.c
index 9f741a8..81a74e7 100644
--- a/src/treewalk.c
+++ b/src/treewalk.c
@@ -162,7 +162,7 @@ void libhqr_treewalk(const libhqr_tree_t *qrtree, int k, int *tiles)
  ***************************************************/
 
 void libhqr_print_tree(const libhqr_tree_t *qrtree, libhqr_tiledesc_t *matrix){
-    int maxMN, minMN, k, i, step_m;
+    int maxMN, minMN, k, i;
     int *tiles;
     int *step;
     FILE *file;
-- 
GitLab