build: apply suggestions from code review

Co-Authored-By: Anonymous Maarten <madebr@users.noreply.github.com>
This commit is contained in:
Carlos Gomes Martinho 2020-03-31 21:07:19 +02:00
parent b0f413037a
commit fffdca0504
2 changed files with 9 additions and 12 deletions

View File

@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
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)

View File

@ -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 <dlfcn.h> 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/"