From fffdca0504ec374e50bebe9152591b11b1092c6f Mon Sep 17 00:00:00 2001 From: Carlos Gomes Martinho Date: Tue, 31 Mar 2020 21:07:19 +0200 Subject: [PATCH] build: apply suggestions from code review Co-Authored-By: Anonymous Maarten --- CMakeLists.txt | 12 ++++++------ mbus/config.h.in | 9 +++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29d0fba..b5533f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ if(LIBMBUS_RUN_CLANG_TIDY) endif(LIBMBUS_RUN_CLANG_TIDY) if(LIBMBUS_ENABLE_COVERAGE) - if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + if(NOT CMAKE_BUILD_TYPE MATCHES "(Debug)|(RelWithDebInfo)") message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading") endif() @@ -94,7 +94,7 @@ set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") set(PACKAGE_VERSION "${PROJECT_VERSION}") set(VERSION "${PROJECT_VERSION}") -configure_file(${CMAKE_CURRENT_LIST_DIR}/mbus/config.h.in ${CMAKE_CURRENT_LIST_DIR}/config.h) +configure_file(${CMAKE_CURRENT_LIST_DIR}/mbus/config.h.in ${CMAKE_CURRENT_LIST_DIR}/config.h @ONLY) add_library( ${PROJECT_NAME} @@ -111,7 +111,7 @@ add_library( target_include_directories( ${PROJECT_NAME} PUBLIC $ $ $) -if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android) +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android") target_link_libraries(${PROJECT_NAME} PRIVATE m) endif() if(NOT MSVC) @@ -151,13 +151,13 @@ include(GNUInstallDirs) include(CMakePackageConfigHelpers) set(INSTALL_PKGCONFIG_DIR - "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" + "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") set(INSTALL_INC_DIR - "${CMAKE_INSTALL_PREFIX}/mbus" + "${CMAKE_INSTALL_INCLUDEDIR}/mbus" CACHE PATH "Installation directory for headers") set(INSTALL_LIB_DIR - "${CMAKE_INSTALL_PREFIX}/lib" + "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation directory for libraries") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libmbus.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libmbus.pc @ONLY) diff --git a/mbus/config.h.in b/mbus/config.h.in index 369c7c8..9b818f6 100644 --- a/mbus/config.h.in +++ b/mbus/config.h.in @@ -1,6 +1,3 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DLFCN_H "@HAVE_DLFCN_H@" @@ -35,19 +32,19 @@ #define LT_OBJDIR ".libs/" /* Name of package */ -#define PACKAGE "libmbus" +#define PACKAGE "@PROJECT_NAME@" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "info@rscada.se" /* Define to the full name of this package. */ -#define PACKAGE_NAME "libmbus" +#define PACKAGE_NAME "@PROJECT_NAME@" /* Define to the full name and version of this package. */ #cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" /* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libmbus" +#define PACKAGE_TARNAME "@PROJECT_NAME@" /* Define to the home page for this package. */ #define PACKAGE_URL "http://www.rscada.se/libmbus/"