summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGcov.cmake171
-rw-r--r--cmake/FindLcov.cmake365
-rw-r--r--cmake/FindMySQL.cmake73
-rw-r--r--cmake/FindODBC.cmake34
-rw-r--r--cmake/FindPostgres.cmake36
-rw-r--r--cmake/Findcodecov.cmake270
-rw-r--r--cmake/GCoveralls.cmake11
-rw-r--r--cmake/GammuTuneFlags.cmake2
-rw-r--r--cmake/MacroCheckLibraryWorks.cmake23
-rwxr-xr-xcmake/coveralls-upload.in60
-rwxr-xr-xcmake/llvm-cov-wrapper70
-rw-r--r--cmake/templates/gammu-config.h.cmake11
-rw-r--r--cmake/templates/gammu.spec.in4
13 files changed, 1009 insertions, 121 deletions
diff --git a/cmake/FindGcov.cmake b/cmake/FindGcov.cmake
new file mode 100644
index 0000000..8ffb7c6
--- /dev/null
+++ b/cmake/FindGcov.cmake
@@ -0,0 +1,171 @@
+# This file is part of CMake-codecov.
+#
+# CMake-codecov is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful,but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see
+#
+# http://www.gnu.org/licenses/
+#
+#
+# Copyright (c)
+# 2015-2016 RWTH Aachen University, Federal Republic of Germany
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+
+# include required Modules
+include(FindPackageHandleStandardArgs)
+
+
+# Search for gcov binary.
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
+
+get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach (LANG ${ENABLED_LANGUAGES})
+ # Gcov evaluation is dependend on the used compiler. Check gcov support for
+ # each compiler that is used. If gcov binary was already found for this
+ # compiler, do not try to find it again.
+ if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)
+ get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH)
+
+ if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU")
+ # Some distributions like OSX (homebrew) ship gcov with the compiler
+ # version appended as gcov-x. To find this binary we'll build the
+ # suggested binary name with the compiler version.
+ string(REGEX MATCH "^[0-9]+" GCC_VERSION
+ "${CMAKE_${LANG}_COMPILER_VERSION}")
+
+ find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov
+ HINTS ${COMPILER_PATH})
+
+ elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang")
+ # Some distributions like Debian ship llvm-cov with the compiler
+ # version appended as llvm-cov-x.y. To find this binary we'll build
+ # the suggested binary name with the compiler version.
+ string(REGEX MATCH "^[0-9]+.[0-9]+" LLVM_VERSION
+ "${CMAKE_${LANG}_COMPILER_VERSION}")
+
+ # llvm-cov prior version 3.5 seems to be not working with coverage
+ # evaluation tools, but these versions are compatible with the gcc
+ # gcov tool.
+ if(LLVM_VERSION VERSION_GREATER 3.4)
+ find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}"
+ "llvm-cov" HINTS ${COMPILER_PATH})
+ mark_as_advanced(LLVM_COV_BIN)
+
+ if (LLVM_COV_BIN)
+ find_program(LLVM_COV_WRAPPER "llvm-cov-wrapper" PATHS
+ ${CMAKE_MODULE_PATH})
+ if (LLVM_COV_WRAPPER)
+ set(GCOV_BIN "${LLVM_COV_WRAPPER}" CACHE FILEPATH "")
+
+ # set additional parameters
+ set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV
+ "LLVM_COV_BIN=${LLVM_COV_BIN}" CACHE STRING
+ "Environment variables for llvm-cov-wrapper.")
+ mark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV)
+ endif ()
+ endif ()
+ endif ()
+
+ if (NOT GCOV_BIN)
+ # Fall back to gcov binary if llvm-cov was not found or is
+ # incompatible. This is the default on OSX, but may crash on
+ # recent Linux versions.
+ find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH})
+ endif ()
+ endif ()
+
+
+ if (GCOV_BIN)
+ set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN "${GCOV_BIN}" CACHE STRING
+ "${LANG} gcov binary.")
+
+ if (NOT CMAKE_REQUIRED_QUIET)
+ message("-- Found gcov evaluation for "
+ "${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}")
+ endif()
+
+ unset(GCOV_BIN CACHE)
+ endif ()
+ endif ()
+endforeach ()
+
+
+
+
+# Add a new global target for all gcov targets. This target could be used to
+# generate the gcov files for the whole project instead of calling <TARGET>-gcov
+# for each target.
+if (NOT TARGET gcov)
+ add_custom_target(gcov)
+endif (NOT TARGET gcov)
+
+
+
+# This function will add gcov evaluation for target <TNAME>. Only sources of
+# this target will be evaluated and no dependencies will be added. It will call
+# Gcov on any source file of <TNAME> once and store the gcov file in the same
+# directory.
+function (add_gcov_target TNAME)
+ set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
+
+ # We don't have to check, if the target has support for coverage, thus this
+ # will be checked by add_coverage_target in Findcoverage.cmake. Instead we
+ # have to determine which gcov binary to use.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(SOURCES "")
+ set(TCOMPILER "")
+ foreach (FILE ${TSOURCES})
+ codecov_path_of_source(${FILE} FILE)
+ if (NOT "${FILE}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (NOT "${LANG}" STREQUAL "")
+ list(APPEND SOURCES "${FILE}")
+ set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ endif ()
+ endif ()
+ endforeach ()
+
+ # If no gcov binary was found, coverage data can't be evaluated.
+ if (NOT GCOV_${TCOMPILER}_BIN)
+ message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
+ return()
+ endif ()
+
+ set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
+ set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
+
+
+ set(BUFFER "")
+ foreach(FILE ${SOURCES})
+ get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH)
+
+ # call gcov
+ add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov
+ COMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null
+ DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno
+ WORKING_DIRECTORY ${FILE_PATH}
+ )
+
+ list(APPEND BUFFER ${TDIR}/${FILE}.gcov)
+ endforeach()
+
+
+ # add target for gcov evaluation of <TNAME>
+ add_custom_target(${TNAME}-gcov DEPENDS ${BUFFER})
+
+ # add evaluation target to the global gcov target.
+ add_dependencies(gcov ${TNAME}-gcov)
+endfunction (add_gcov_target)
diff --git a/cmake/FindLcov.cmake b/cmake/FindLcov.cmake
new file mode 100644
index 0000000..f92fca3
--- /dev/null
+++ b/cmake/FindLcov.cmake
@@ -0,0 +1,365 @@
+# This file is part of CMake-codecov.
+#
+# CMake-codecov is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful,but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see
+#
+# http://www.gnu.org/licenses/
+#
+#
+# Copyright (c)
+# 2015-2016 RWTH Aachen University, Federal Republic of Germany
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+
+# configuration
+set(LCOV_DATA_PATH "${CMAKE_BINARY_DIR}/lcov/data")
+set(LCOV_DATA_PATH_INIT "${LCOV_DATA_PATH}/init")
+set(LCOV_DATA_PATH_CAPTURE "${LCOV_DATA_PATH}/capture")
+set(LCOV_HTML_PATH "${CMAKE_BINARY_DIR}/lcov/html")
+
+
+
+
+# Search for Gcov which is used by Lcov.
+find_package(Gcov)
+
+
+
+
+# This function will add lcov evaluation for target <TNAME>. Only sources of
+# this target will be evaluated and no dependencies will be added. It will call
+# geninfo on any source file of <TNAME> once and store the info file in the same
+# directory.
+#
+# Note: This function is only a wrapper to define this function always, even if
+# coverage is not supported by the compiler or disabled. This function must
+# be defined here, because the module will be exited, if there is no coverage
+# support by the compiler or it is disabled by the user.
+function (add_lcov_target TNAME)
+ if (LCOV_FOUND)
+ # capture initial coverage data
+ lcov_capture_initial_tgt(${TNAME})
+
+ # capture coverage data after execution
+ lcov_capture_tgt(${TNAME})
+ endif ()
+endfunction (add_lcov_target)
+
+
+
+
+# include required Modules
+include(FindPackageHandleStandardArgs)
+
+# Search for required lcov binaries.
+find_program(LCOV_BIN lcov)
+find_program(GENINFO_BIN geninfo)
+find_program(GENHTML_BIN genhtml)
+find_package_handle_standard_args(lcov
+ REQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN
+)
+
+# enable genhtml C++ demangeling, if c++filt is found.
+set(GENHTML_CPPFILT_FLAG "")
+find_program(CPPFILT_BIN c++filt)
+if (NOT CPPFILT_BIN STREQUAL "")
+ set(GENHTML_CPPFILT_FLAG "--demangle-cpp")
+endif (NOT CPPFILT_BIN STREQUAL "")
+
+# enable no-external flag for lcov, if available.
+if (GENINFO_BIN AND NOT DEFINED GENINFO_EXTERN_FLAG)
+ set(FLAG "")
+ execute_process(COMMAND ${GENINFO_BIN} --help OUTPUT_VARIABLE GENINFO_HELP)
+ string(REGEX MATCH "external" GENINFO_RES "${GENINFO_HELP}")
+ if (GENINFO_RES)
+ set(FLAG "--no-external")
+ endif ()
+
+ set(GENINFO_EXTERN_FLAG "${FLAG}"
+ CACHE STRING "Geninfo flag to exclude system sources.")
+endif ()
+
+# If Lcov was not found, exit module now.
+if (NOT LCOV_FOUND)
+ return()
+endif (NOT LCOV_FOUND)
+
+
+
+
+# Create directories to be used.
+file(MAKE_DIRECTORY ${LCOV_DATA_PATH_INIT})
+file(MAKE_DIRECTORY ${LCOV_DATA_PATH_CAPTURE})
+
+
+# This function will merge lcov files to a single target file. Additional lcov
+# flags may be set with setting LCOV_EXTRA_FLAGS before calling this function.
+function (lcov_merge_files OUTFILE ...)
+ # Remove ${OUTFILE} from ${ARGV} and generate lcov parameters with files.
+ list(REMOVE_AT ARGV 0)
+
+ # Generate merged file.
+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" FILE_REL "${OUTFILE}")
+ add_custom_command(OUTPUT "${OUTFILE}.raw"
+ COMMAND cat ${ARGV} > ${OUTFILE}.raw
+ DEPENDS ${ARGV}
+ COMMENT "Generating ${FILE_REL}"
+ )
+
+ add_custom_command(OUTPUT "${OUTFILE}"
+ COMMAND ${LCOV_BIN} --quiet -a ${OUTFILE}.raw --output-file ${OUTFILE}
+ --base-directory ${PROJECT_SOURCE_DIR} ${LCOV_EXTRA_FLAGS}
+ DEPENDS ${OUTFILE}.raw
+ COMMENT "Post-processing ${FILE_REL}"
+ )
+endfunction ()
+
+
+
+
+# Add a new global target to generate initial coverage reports for all targets.
+# This target will be used to generate the global initial info file, which is
+# used to gather even empty report data.
+if (NOT TARGET lcov-capture-init)
+ add_custom_target(lcov-capture-init)
+ set(LCOV_CAPTURE_INIT_FILES "" CACHE INTERNAL "")
+endif (NOT TARGET lcov-capture-init)
+
+
+# This function will add initial capture of coverage data for target <TNAME>,
+# which is needed to get also data for objects, which were not loaded at
+# execution time. It will call geninfo for every source file of <TNAME> once and
+# store the info file in the same directory.
+function (lcov_capture_initial_tgt TNAME)
+ # We don't have to check, if the target has support for coverage, thus this
+ # will be checked by add_coverage_target in Findcoverage.cmake. Instead we
+ # have to determine which gcov binary to use.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(SOURCES "")
+ set(TCOMPILER "")
+ foreach (FILE ${TSOURCES})
+ codecov_path_of_source(${FILE} FILE)
+ if (NOT "${FILE}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (NOT "${LANG}" STREQUAL "")
+ list(APPEND SOURCES "${FILE}")
+ set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ endif ()
+ endif ()
+ endforeach ()
+
+ # If no gcov binary was found, coverage data can't be evaluated.
+ if (NOT GCOV_${TCOMPILER}_BIN)
+ message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
+ return()
+ endif ()
+
+ set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
+ set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
+
+
+ set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
+ set(GENINFO_FILES "")
+ foreach(FILE ${SOURCES})
+ # generate empty coverage files
+ set(OUTFILE "${TDIR}/${FILE}.info.init")
+ list(APPEND GENINFO_FILES ${OUTFILE})
+
+ add_custom_command(OUTPUT ${OUTFILE} COMMAND ${GCOV_ENV} ${GENINFO_BIN}
+ --quiet --base-directory ${PROJECT_SOURCE_DIR} --initial
+ --gcov-tool ${GCOV_BIN} --output-filename ${OUTFILE}
+ ${GENINFO_EXTERN_FLAG} ${TDIR}/${FILE}.gcno
+ DEPENDS ${TNAME}
+ COMMENT "Capturing initial coverage data for ${FILE}"
+ )
+ endforeach()
+
+ # Concatenate all files generated by geninfo to a single file per target.
+ set(OUTFILE "${LCOV_DATA_PATH_INIT}/${TNAME}.info")
+ set(LCOV_EXTRA_FLAGS "--initial")
+ lcov_merge_files("${OUTFILE}" ${GENINFO_FILES})
+ add_custom_target(${TNAME}-capture-init ALL DEPENDS ${OUTFILE})
+
+ # add geninfo file generation to global lcov-geninfo target
+ add_dependencies(lcov-capture-init ${TNAME}-capture-init)
+ set(LCOV_CAPTURE_INIT_FILES "${LCOV_CAPTURE_INIT_FILES}"
+ "${OUTFILE}" CACHE INTERNAL ""
+ )
+endfunction (lcov_capture_initial_tgt)
+
+
+# This function will generate the global info file for all targets. It has to be
+# called after all other CMake functions in the root CMakeLists.txt file, to get
+# a full list of all targets that generate coverage data.
+function (lcov_capture_initial)
+ # Skip this function (and do not create the following targets), if there are
+ # no input files.
+ if ("${LCOV_CAPTURE_INIT_FILES}" STREQUAL "")
+ return()
+ endif ()
+
+ # Add a new target to merge the files of all targets.
+ set(OUTFILE "${LCOV_DATA_PATH_INIT}/all_targets.info")
+ lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_INIT_FILES})
+ add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE}
+ lcov-capture-init
+ )
+endfunction (lcov_capture_initial)
+
+
+
+
+# Add a new global target to generate coverage reports for all targets. This
+# target will be used to generate the global info file.
+if (NOT TARGET lcov-capture)
+ add_custom_target(lcov-capture)
+ set(LCOV_CAPTURE_FILES "" CACHE INTERNAL "")
+endif (NOT TARGET lcov-capture)
+
+
+# This function will add capture of coverage data for target <TNAME>, which is
+# needed to get also data for objects, which were not loaded at execution time.
+# It will call geninfo for every source file of <TNAME> once and store the info
+# file in the same directory.
+function (lcov_capture_tgt TNAME)
+ # We don't have to check, if the target has support for coverage, thus this
+ # will be checked by add_coverage_target in Findcoverage.cmake. Instead we
+ # have to determine which gcov binary to use.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(SOURCES "")
+ set(TCOMPILER "")
+ foreach (FILE ${TSOURCES})
+ codecov_path_of_source(${FILE} FILE)
+ if (NOT "${FILE}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (NOT "${LANG}" STREQUAL "")
+ list(APPEND SOURCES "${FILE}")
+ set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ endif ()
+ endif ()
+ endforeach ()
+
+ # If no gcov binary was found, coverage data can't be evaluated.
+ if (NOT GCOV_${TCOMPILER}_BIN)
+ message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
+ return()
+ endif ()
+
+ set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
+ set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
+
+
+ set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
+ set(GENINFO_FILES "")
+ foreach(FILE ${SOURCES})
+ # Generate coverage files. If no .gcda file was generated during
+ # execution, the empty coverage file will be used instead.
+ set(OUTFILE "${TDIR}/${FILE}.info")
+ list(APPEND GENINFO_FILES ${OUTFILE})
+
+ add_custom_command(OUTPUT ${OUTFILE}
+ COMMAND test -f "${TDIR}/${FILE}.gcda"
+ && ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory
+ ${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN}
+ --output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG}
+ ${TDIR}/${FILE}.gcda
+ || cp ${OUTFILE}.init ${OUTFILE}
+ DEPENDS ${TNAME} ${TNAME}-capture-init
+ COMMENT "Capturing coverage data for ${FILE}"
+ )
+ endforeach()
+
+ # Concatenate all files generated by geninfo to a single file per target.
+ set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/${TNAME}.info")
+ lcov_merge_files("${OUTFILE}" ${GENINFO_FILES})
+ add_custom_target(${TNAME}-geninfo DEPENDS ${OUTFILE})
+
+ # add geninfo file generation to global lcov-capture target
+ add_dependencies(lcov-capture ${TNAME}-geninfo)
+ set(LCOV_CAPTURE_FILES "${LCOV_CAPTURE_FILES}" "${OUTFILE}" CACHE INTERNAL
+ ""
+ )
+
+ # Add target for generating html output for this target only.
+ file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/${TNAME})
+ add_custom_target(${TNAME}-genhtml
+ COMMAND ${GENHTML_BIN} --quiet --sort --prefix ${PROJECT_SOURCE_DIR}
+ --baseline-file ${LCOV_DATA_PATH_INIT}/${TNAME}.info
+ --output-directory ${LCOV_HTML_PATH}/${TNAME}
+ --title "${CMAKE_PROJECT_NAME} - target ${TNAME}"
+ ${GENHTML_CPPFILT_FLAG} ${OUTFILE}
+ DEPENDS ${TNAME}-geninfo ${TNAME}-capture-init
+ )
+endfunction (lcov_capture_tgt)
+
+
+# This function will generate the global info file for all targets. It has to be
+# called after all other CMake functions in the root CMakeLists.txt file, to get
+# a full list of all targets that generate coverage data.
+function (lcov_capture)
+ # Skip this function (and do not create the following targets), if there are
+ # no input files.
+ if ("${LCOV_CAPTURE_FILES}" STREQUAL "")
+ return()
+ endif ()
+
+ # Add a new target to merge the files of all targets.
+ set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/all_targets.info")
+ lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_FILES})
+ add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture)
+
+ # Add a new global target for all lcov targets. This target could be used to
+ # generate the lcov html output for the whole project instead of calling
+ # <TARGET>-geninfo and <TARGET>-genhtml for each target. It will also be
+ # used to generate a html site for all project data together instead of one
+ # for each target.
+ if (NOT TARGET lcov)
+ file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/all_targets)
+ add_custom_target(lcov
+ COMMAND ${GENHTML_BIN} --quiet --sort
+ --baseline-file ${LCOV_DATA_PATH_INIT}/all_targets.info
+ --output-directory ${LCOV_HTML_PATH}/all_targets
+ --title "${CMAKE_PROJECT_NAME}" --prefix "${PROJECT_SOURCE_DIR}"
+ ${GENHTML_CPPFILT_FLAG} ${OUTFILE}
+ DEPENDS lcov-geninfo-init lcov-geninfo
+ )
+ endif ()
+endfunction (lcov_capture)
+
+
+
+
+# Add a new global target to generate the lcov html report for the whole project
+# instead of calling <TARGET>-genhtml for each target (to create an own report
+# for each target). Instead of the lcov target it does not require geninfo for
+# all targets, so you have to call <TARGET>-geninfo to generate the info files
+# the targets you'd like to have in your report or lcov-geninfo for generating
+# info files for all targets before calling lcov-genhtml.
+file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/selected_targets)
+if (NOT TARGET lcov-genhtml)
+ add_custom_target(lcov-genhtml
+ COMMAND ${GENHTML_BIN}
+ --quiet
+ --output-directory ${LCOV_HTML_PATH}/selected_targets
+ --title \"${CMAKE_PROJECT_NAME} - targets `find
+ ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name
+ \"all_targets.info\" -exec basename {} .info \\\;`\"
+ --prefix ${PROJECT_SOURCE_DIR}
+ --sort
+ ${GENHTML_CPPFILT_FLAG}
+ `find ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name
+ \"all_targets.info\"`
+ )
+endif (NOT TARGET lcov-genhtml)
diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake
index dd1e706..453ea43 100644
--- a/cmake/FindMySQL.cmake
+++ b/cmake/FindMySQL.cmake
@@ -13,7 +13,7 @@
# Redistribution and use is allowed according to the terms of the BSD license.
-if(UNIX)
+if(UNIX)
set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
"preferred path to MySQL (mysql_config)")
find_program(MYSQL_CONFIG mysql_config
@@ -22,8 +22,8 @@ if(UNIX)
/usr/local/bin/
/usr/bin/
)
-
- if(MYSQL_CONFIG)
+
+ if(MYSQL_CONFIG)
message(STATUS "Using mysql-config: ${MYSQL_CONFIG}")
# set INCLUDE_DIR
exec_program(${MYSQL_CONFIG}
@@ -62,33 +62,58 @@ if(UNIX)
else(UNIX)
if (WIN32)
set(MYSQL_ADD_LIBRARIES "")
- list(APPEND MYSQL_ADD_LIBRARIES "mysql")
+ list(APPEND MYSQL_ADD_LIBRARIES "mysqlclient")
endif (WIN32)
set(MYSQL_ADD_INCLUDE_DIR "c:/msys/local/include" CACHE FILEPATH INTERNAL)
set(MYSQL_ADD_LIBRARY_PATH "c:/msys/local/lib" CACHE FILEPATH INTERNAL)
ENDIF(UNIX)
-find_path(MYSQL_INCLUDE_DIR mysql.h
- /usr/local/include
- /usr/local/include/mysql
- /usr/local/mysql/include
- /usr/local/mysql/include/mysql
- /usr/include
- /usr/include/mysql
- ${MYSQL_ADD_INCLUDE_DIR}
-)
+if (WIN32)
+ find_path(MYSQL_INCLUDE_DIR mysql.h
+ /usr/local/include
+ /usr/local/include/mysql
+ /usr/local/mysql/include
+ /usr/local/mysql/include/mysql
+ /usr/include
+ /usr/include/mysql
+ $ENV{MYSQL_DIR}/include
+ $ENV{ProgramFiles}/MySQL/*/include
+ $ENV{SystemDrive}/MySQL/*/include
+ "C:/Program Files/MySQL/*/include"
+ ${MYSQL_ADD_INCLUDE_DIR}
+ )
+else()
+ find_path(MYSQL_INCLUDE_DIR mysql.h
+ /usr/local/include
+ /usr/local/include/mysql
+ /usr/local/mysql/include
+ /usr/local/mysql/include/mysql
+ /usr/include
+ /usr/include/mysql
+ ${MYSQL_ADD_INCLUDE_DIR}
+ )
+endif()
set(TMP_MYSQL_LIBRARIES "")
foreach(LIB ${MYSQL_ADD_LIBRARIES})
- find_library("MYSQL_LIBRARIES_${LIB}" NAMES ${LIB}
- PATHS
- ${MYSQL_ADD_LIBRARY_PATH}
- /usr/lib/mysql
- /usr/local/lib
- /usr/local/lib/mysql
- /usr/local/mysql/lib
- )
+ if (WIN32)
+ find_library("MYSQL_LIBRARIES_${LIB}" NAMES ${LIB}
+ PATHS
+ ${MYSQL_ADD_LIBRARY_PATH}
+ /usr/lib/mysql
+ /usr/local/lib
+ /usr/local/lib/mysql
+ /usr/local/mysql/lib
+ $ENV{MYSQL_DIR}/lib/opt
+ $ENV{ProgramFiles}/MySQL/*/lib
+ $ENV{SystemDrive}/MySQL/*/lib
+ "C:/Program Files/MySQL/*/lib"
+ $ENV{ProgramFiles}/MySQL/*/lib/opt
+ $ENV{SystemDrive}/MySQL/*/lib/opt
+ "C:/Program Files/MySQL/*/lib/opt"
+ )
+ endif()
list(APPEND TMP_MYSQL_LIBRARIES "${MYSQL_LIBRARIES_${LIB}}")
endforeach(LIB ${MYSQL_ADD_LIBRARIES})
@@ -98,8 +123,12 @@ else (TMP_MYSQL_LIBRARIES)
set(MYSQL_LIBRARIES ${TMP_MYSQL_LIBRARIES} CACHE FILEPATH "MySQL Libraries")
endif (TMP_MYSQL_LIBRARIES)
+
if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
- set(MYSQL_FOUND TRUE CACHE INTERNAL "MySQL found")
+ include(MacroCheckLibraryWorks)
+ CHECK_LIBRARY_WORKS("mysql.h" "mysql_errno(0);" "${MYSQL_INCLUDE_DIR}" "${MYSQL_LIBRARIES}" "MYSQL_WORKS")
+
+ set(MYSQL_FOUND ${MYSQL_WORKS} CACHE INTERNAL "MySQL found")
message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
set(MYSQL_FOUND FALSE CACHE INTERNAL "MySQL found")
diff --git a/cmake/FindODBC.cmake b/cmake/FindODBC.cmake
index 077baec..51baf67 100644
--- a/cmake/FindODBC.cmake
+++ b/cmake/FindODBC.cmake
@@ -1,11 +1,33 @@
# Find ODBC (or UnixODBC)
find_path(ODBC_INCLUDE_DIR NAMES sql.h
- DOC "The ODBC include directory"
+ HINTS
+ /usr/include
+ /usr/include/odbc
+ /usr/local/include
+ /usr/local/include/odbc
+ /usr/local/odbc/include
+ "C:/Program Files/ODBC/include"
+ "C:/Program Files/Microsoft SDKs/Windows/*/Include"
+ "$ENV{ProgramFiles}/Microsoft SDKs/Windows/*/Include"
+ "C:/ODBC/include"
+ DOC "The ODBC include directory"
)
-find_library(ODBC_LIBRARY NAMES odbc odbc32
- DOC "The ODBC library"
+find_library(ODBC_LIBRARY NAMES iodbc odbc odbc32
+ HINTS
+ /usr/lib
+ /usr/lib/odbc
+ /usr/local/lib
+ /usr/local/lib/odbc
+ /usr/local/odbc/lib
+ "C:/Program Files/ODBC/lib"
+ "C:/ODBC/lib/debug"
+ "$ENV{ProgramFiles}/Microsoft SDKs/Windows/*/Lib/${CMAKE_VS_PLATFORM_NAME}"
+ "C:/Program Files/Microsoft SDKs/Windows/*/Lib/${CMAKE_VS_PLATFORM_NAME}"
+ "$ENV{ProgramFiles}/Microsoft SDKs/Windows/*/Lib"
+ "C:/Program Files/Microsoft SDKs/Windows/*/Lib"
+ DOC "The ODBC library"
)
# handle the QUIETLY and REQUIRED arguments and set ODBC_FOUND to TRUE if
@@ -14,6 +36,12 @@ include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ODBC DEFAULT_MSG ODBC_LIBRARY ODBC_INCLUDE_DIR)
if(ODBC_FOUND)
+ include(MacroCheckLibraryWorks)
+ CHECK_LIBRARY_WORKS("sql.h" "SQLAllocHandle (SQL_HANDLE_ENV, SQL_NULL_HANDLE, 0);" "${ODBC_INCLUDE_DIR}" "${ODBC_LIBRARY}" "ODBC_WORKS")
+ if (NOT ${ODBC_WORKS})
+ set(ODBC_FOUND FALSE)
+ endif()
+
set( ODBC_LIBRARIES ${ODBC_LIBRARY} )
set( ODBC_INCLUDE_DIRS ${ODBC_INCLUDE_DIR} )
endif(ODBC_FOUND)
diff --git a/cmake/FindPostgres.cmake b/cmake/FindPostgres.cmake
index 753f418..eeea7f2 100644
--- a/cmake/FindPostgres.cmake
+++ b/cmake/FindPostgres.cmake
@@ -9,14 +9,29 @@
# POSTGRES_LIBRARY
IF(WIN32)
- IF (NOT POSTGRES_INCLUDE_DIR)
- FIND_PATH(POSTGRES_INCLUDE_DIR libpq-fe.h /usr/local/include /usr/include c:/msys/local/include)
- ENDIF (NOT POSTGRES_INCLUDE_DIR)
-
- IF (NOT POSTGRES_LIBRARY)
- FIND_LIBRARY(POSTGRES_LIBRARY NAMES pq PATH /usr/local/lib /usr/lib c:/msys/local/lib)
- ENDIF (NOT POSTGRES_LIBRARY)
+ FIND_PATH(POSTGRES_INCLUDE_DIR libpq-fe.h
+ /usr/local/include /usr/include c:/msys/local/include
+ $ENV{POSTGRESQL_PATH}/include/server
+ $ENV{POSTGRESQL_PATH}/include
+ "C:/Program Files/PostgreSQL/*/include/server"
+ $ENV{ProgramFiles}/PostgreSQL/*/include/server
+ $ENV{SystemDrive}/PostgreSQL/*/include/server
+ "C:/Program Files/PostgreSQL/*/include"
+ $ENV{ProgramFiles}/PostgreSQL/*/include
+ $ENV{SystemDrive}/PostgreSQL/*/include
+ )
+ FIND_LIBRARY(POSTGRES_LIBRARY NAMES libpq pq PATHS
+ /usr/local/lib /usr/lib c:/msys/local/lib
+ $ENV{POSTGRESQL_PATH}/lib
+ $ENV{ProgramFiles}/PostgreSQL/*/lib
+ $ENV{SystemDrive}/PostgreSQL/*/lib
+ "C:/Program Files/PostgreSQL/*/lib"
+ $ENV{POSTGRESQL_PATH}/lib/ms
+ $ENV{ProgramFiles}/PostgreSQL/*/lib/ms
+ $ENV{SystemDrive}/PostgreSQL/*/lib/ms
+ "C:/Program Files/PostgreSQL/*/lib/ms"
+ )
ELSE(WIN32)
IF(UNIX)
@@ -60,7 +75,9 @@ ELSE(WIN32)
ENDIF(WIN32)
IF (POSTGRES_INCLUDE_DIR AND POSTGRES_LIBRARY)
- SET(POSTGRES_FOUND TRUE CACHE INTERNAL "PostgreSQL found")
+ include(MacroCheckLibraryWorks)
+ CHECK_LIBRARY_WORKS("libpq-fe.h" "PQclear(NULL);" "${POSTGRES_INCLUDE_DIR}" "${POSTGRES_LIBRARY}" "POSTGRES_WORKS")
+ SET(POSTGRES_FOUND ${POSTGRES_WORKS} CACHE INTERNAL "PostgreSQL found")
ENDIF (POSTGRES_INCLUDE_DIR AND POSTGRES_LIBRARY)
@@ -74,9 +91,6 @@ IF (POSTGRES_FOUND)
ELSE (POSTGRES_FOUND)
- #SET (POSTGRES_INCLUDE_DIR "")
- #SET (POSTGRES_LIBRARY "")
-
IF (POSTGRES_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find PostgreSQL")
ELSE (POSTGRES_FIND_REQUIRED)
diff --git a/cmake/Findcodecov.cmake b/cmake/Findcodecov.cmake
new file mode 100644
index 0000000..60c7c5d
--- /dev/null
+++ b/cmake/Findcodecov.cmake
@@ -0,0 +1,270 @@
+# This file is part of CMake-codecov.
+#
+# CMake-codecov is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful,but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see
+#
+# http://www.gnu.org/licenses/
+#
+#
+# Copyright (c)
+# 2015-2016 RWTH Aachen University, Federal Republic of Germany
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+
+# Set neccessary policies to avoid developer warnings at configuration time.
+foreach (POL CMP0011 CMP0051)
+ if (POLICY ${POL})
+ cmake_policy(SET ${POL} NEW)
+ endif ()
+endforeach ()
+
+
+# Add an option to choose, if coverage should be enabled or not. If enabled
+# marked targets will be build with coverage support and appropriate targets
+# will be added. If disabled coverage will be ignored for *ALL* targets.
+option(ENABLE_COVERAGE "Enable coverage build." OFF)
+
+set(COVERAGE_FLAG_CANDIDATES
+ # gcc and clang
+ "-O0 -g -fprofile-arcs -ftest-coverage"
+
+ # gcc and clang fallback
+ "-O0 -g --coverage"
+)
+
+
+# Add coverage support for target ${TNAME} and register target for coverage
+# evaluation. If coverage is disabled or not supported, this function will
+# simply do nothing.
+#
+# Note: This function is only a wrapper to define this function always, even if
+# coverage is not supported by the compiler or disabled. This function must
+# be defined here, because the module will be exited, if there is no coverage
+# support by the compiler or it is disabled by the user.
+function (add_coverage TNAME)
+ # only add coverage for target, if coverage is support and enabled.
+ if (ENABLE_COVERAGE)
+ foreach (TNAME ${ARGV})
+ add_coverage_target(${TNAME})
+ endforeach ()
+ endif ()
+endfunction (add_coverage)
+
+
+# Add global target to gather coverage information after all targets have been
+# added. Other evaluation functions could be added here, after checks for the
+# specific module have been passed.
+#
+# Note: This function is only a wrapper to define this function always, even if
+# coverage is not supported by the compiler or disabled. This function must
+# be defined here, because the module will be exited, if there is no coverage
+# support by the compiler or it is disabled by the user.
+function (coverage_evaluate)
+ # add lcov evaluation
+ if (LCOV_FOUND)
+ lcov_capture_initial()
+ lcov_capture()
+ endif (LCOV_FOUND)
+endfunction ()
+
+
+# Exit this module, if coverage is disabled. add_coverage is defined before this
+# return, so this module can be exited now safely without breaking any build-
+# scripts.
+if (NOT ENABLE_COVERAGE)
+ return()
+endif ()
+
+
+
+
+# Find the reuired flags foreach language.
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
+
+get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach (LANG ${ENABLED_LANGUAGES})
+ # Coverage flags are not dependend on language, but the used compiler. So
+ # instead of searching flags foreach language, search flags foreach compiler
+ # used.
+ set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ if (NOT COVERAGE_${COMPILER}_FLAGS)
+ foreach (FLAG ${COVERAGE_FLAG_CANDIDATES})
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try ${COMPILER} code coverage flag = [${FLAG}]")
+ endif()
+
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ unset(COVERAGE_FLAG_DETECTED CACHE)
+
+ if (${LANG} STREQUAL "C")
+ include(CheckCCompilerFlag)
+ check_c_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED)
+
+ elseif (${LANG} STREQUAL "CXX")
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED)
+
+ elseif (${LANG} STREQUAL "Fortran")
+ # CheckFortranCompilerFlag was introduced in CMake 3.x. To be
+ # compatible with older Cmake versions, we will check if this
+ # module is present before we use it. Otherwise we will define
+ # Fortran coverage support as not available.
+ include(CheckFortranCompilerFlag OPTIONAL
+ RESULT_VARIABLE INCLUDED)
+ if (INCLUDED)
+ check_fortran_compiler_flag("${FLAG}"
+ COVERAGE_FLAG_DETECTED)
+ elseif (NOT CMAKE_REQUIRED_QUIET)
+ message("-- Performing Test COVERAGE_FLAG_DETECTED")
+ message("-- Performing Test COVERAGE_FLAG_DETECTED - Failed"
+ " (Check not supported)")
+ endif ()
+ endif()
+
+ if (COVERAGE_FLAG_DETECTED)
+ set(COVERAGE_${COMPILER}_FLAGS "${FLAG}"
+ CACHE STRING "${COMPILER} flags for code coverage.")
+ mark_as_advanced(COVERAGE_${COMPILER}_FLAGS)
+ break()
+ endif ()
+ endforeach ()
+ endif ()
+endforeach ()
+
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
+
+
+
+
+# Helper function to get the language of a source file.
+function (codecov_lang_of_source FILE RETURN_VAR)
+ get_filename_component(FILE_EXT "${FILE}" EXT)
+ string(TOLOWER "${FILE_EXT}" FILE_EXT)
+ string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
+
+ get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+ foreach (LANG ${ENABLED_LANGUAGES})
+ list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
+ if (NOT ${TEMP} EQUAL -1)
+ set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
+ return()
+ endif ()
+ endforeach()
+
+ set(${RETURN_VAR} "" PARENT_SCOPE)
+endfunction ()
+
+
+# Helper function to get the relative path of the source file destination path.
+# This path is needed by FindGcov and FindLcov cmake files to locate the
+# captured data.
+function (codecov_path_of_source FILE RETURN_VAR)
+ string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _source ${FILE})
+
+ # If expression was found, SOURCEFILE is a generator-expression for an
+ # object library. Currently we found no way to call this function automatic
+ # for the referenced target, so it must be called in the directoryso of the
+ # object library definition.
+ if (NOT "${_source}" STREQUAL "")
+ set(${RETURN_VAR} "" PARENT_SCOPE)
+ return()
+ endif ()
+
+
+ string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" FILE "${FILE}")
+ if(IS_ABSOLUTE ${FILE})
+ file(RELATIVE_PATH FILE ${CMAKE_CURRENT_SOURCE_DIR} ${FILE})
+ endif()
+
+ # get the right path for file
+ string(REPLACE ".." "__" PATH "${FILE}")
+
+ set(${RETURN_VAR} "${PATH}" PARENT_SCOPE)
+endfunction()
+
+
+
+
+# Add coverage support for target ${TNAME} and register target for coverage
+# evaluation.
+function(add_coverage_target TNAME)
+ # Check if all sources for target use the same compiler. If a target uses
+ # e.g. C and Fortran mixed and uses different compilers (e.g. clang and
+ # gfortran) this can trigger huge problems, because different compilers may
+ # use different implementations for code coverage.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(TARGET_COMPILER "")
+ set(ADDITIONAL_FILES "")
+ foreach (FILE ${TSOURCES})
+ # If expression was found, FILE is a generator-expression for an object
+ # library. Object libraries will be ignored.
+ string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
+ if ("${_file}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (LANG)
+ list(APPEND TARGET_COMPILER ${CMAKE_${LANG}_COMPILER_ID})
+
+ list(APPEND ADDITIONAL_FILES "${FILE}.gcno")
+ list(APPEND ADDITIONAL_FILES "${FILE}.gcda")
+ endif ()
+ endif ()
+ endforeach ()
+
+ list(REMOVE_DUPLICATES TARGET_COMPILER)
+ list(LENGTH TARGET_COMPILER NUM_COMPILERS)
+
+ if (NUM_COMPILERS GREATER 1)
+ message(AUTHOR_WARNING "Coverage disabled for target ${TNAME} because "
+ "it will be compiled by different compilers.")
+ return()
+
+ elseif ((NUM_COMPILERS EQUAL 0) OR
+ (NOT DEFINED "COVERAGE_${TARGET_COMPILER}_FLAGS"))
+ message(AUTHOR_WARNING "Coverage disabled for target ${TNAME} "
+ "because there is no sanitizer available for target sources.")
+ return()
+ endif()
+
+
+ # enable coverage for target
+ set_property(TARGET ${TNAME} APPEND_STRING
+ PROPERTY COMPILE_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}")
+ set_property(TARGET ${TNAME} APPEND_STRING
+ PROPERTY LINK_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}")
+
+
+ # Add gcov files generated by compiler to clean target.
+ set(CLEAN_FILES "")
+ foreach (FILE ${ADDITIONAL_FILES})
+ codecov_path_of_source(${FILE} FILE)
+ list(APPEND CLEAN_FILES "CMakeFiles/${TNAME}.dir/${FILE}")
+ endforeach()
+
+ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
+ "${CLEAN_FILES}")
+
+
+ add_gcov_target(${TNAME})
+ add_lcov_target(${TNAME})
+endfunction(add_coverage_target)
+
+
+
+
+# Include modules for parsing the collected data and output it in a readable
+# format (like gcov and lcov).
+find_package(Gcov)
+find_package(Lcov)
diff --git a/cmake/GCoveralls.cmake b/cmake/GCoveralls.cmake
deleted file mode 100644
index 7ffb7ba..0000000
--- a/cmake/GCoveralls.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-if(__GCOVERALLS_CMAKE__)
- return()
-endif()
-set(__GCOVERALLS_CMAKE__ TRUE)
-
-
-set(GCOVERALLS_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-function(enable_gcoveralls)
- configure_file(${GCOVERALLS_LIST_DIR}/coveralls-upload.in ${CMAKE_BINARY_DIR}/coveralls-upload @ONLY)
-endfunction()
diff --git a/cmake/GammuTuneFlags.cmake b/cmake/GammuTuneFlags.cmake
index 8a208bd..f72a7a0 100644
--- a/cmake/GammuTuneFlags.cmake
+++ b/cmake/GammuTuneFlags.cmake
@@ -1,7 +1,7 @@
macro (GAMMU_TUNE_SHARED _target)
if (CMAKE_COMPILER_IS_GNUCC)
if (NOT CMAKE_COMPILER_IS_MINGW AND NOT CMAKE_COMPILER_IS_CYGWIN AND NOT CMAKE_COMPILER_IS_GNUCXX)
- set_target_properties (${_target} PROPERTIES COMPILE_FLAGS -fPIC)
+ set_property(TARGET ${_target} APPEND_STRING PROPERTY COMPILE_FLAGS " -fPIC")
endif (NOT CMAKE_COMPILER_IS_MINGW AND NOT CMAKE_COMPILER_IS_CYGWIN AND NOT CMAKE_COMPILER_IS_GNUCXX)
endif (CMAKE_COMPILER_IS_GNUCC)
endmacro (GAMMU_TUNE_SHARED)
diff --git a/cmake/MacroCheckLibraryWorks.cmake b/cmake/MacroCheckLibraryWorks.cmake
new file mode 100644
index 0000000..c261270
--- /dev/null
+++ b/cmake/MacroCheckLibraryWorks.cmake
@@ -0,0 +1,23 @@
+MACRO (CHECK_LIBRARY_WORKS _header _code _include _library _target)
+
+
+ set(CHECK_LIBRARY_WORKS_BACKUP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
+ set(CHECK_LIBRARY_WORKS_BACKUP_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+ set(CMAKE_REQUIRED_INCLUDES "${_include}")
+ set(CMAKE_REQUIRED_LIBRARIES "${_library}")
+ CHECK_C_SOURCE_COMPILES("
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#include <${_header}>
+
+int main(void) {
+ ${_code}
+ return 0;
+}
+" "${_target}")
+
+ set(CMAKE_REQUIRED_INCLUDES "${CHECK_LIBRARY_WORKS_BACKUP_INCLUDES}")
+ set(CMAKE_REQUIRED_LIBRARIES "${CHECK_LIBRARY_WORKS_BACKUP_LIBRARIES}")
+
+ENDMACRO()
diff --git a/cmake/coveralls-upload.in b/cmake/coveralls-upload.in
deleted file mode 100755
index 32ea462..0000000
--- a/cmake/coveralls-upload.in
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-
-gcov --source-prefix @CMAKE_SOURCE_DIR@ --preserve-paths --relative-only $(find -iname *.gcda) 1>/dev/null || exit 0
-
-if [ ! -z "${TRAVIS_JOB_ID}" ]
-then
-
- cat >coverage.json <<EOF
-{
- "service_name": "travis-ci",
- "service_job_id": "${TRAVIS_JOB_ID}",
- "run_at": "$(date --iso-8601=s)",
- "source_files": [
-EOF
-
-else
-
- cat >coverage.json <<EOF
-{
- "repo_token": "$1",
- "run_at": "$(date --iso-8601=s)",
- "git": {
- "head": {
- "id": "$(git log -1 --pretty=format:%H)",
- "author_name": "$(git log -1 --pretty=format:%an | sed -re 's%\\%\\\\%g; s%"%\\"%g; s%$%\\n%' | tr -d $'\n' | sed -re 's%\\n$%%')",
- "author_email": "$(git log -1 --pretty=format:%ae | sed -re 's%\\%\\\\%g; s%"%\\"%g; s%$%\\n%' | tr -d $'\n' | sed -re 's%\\n$%%')",
- "committer_name": "$(git log -1 --pretty=format:%cn | sed -re 's%\\%\\\\%g; s%"%\\"%g; s%$%\\n%' | tr -d $'\n' | sed -re 's%\\n$%%')",
- "committer_email": "$(git log -1 --pretty=format:%ce | sed -re 's%\\%\\\\%g; s%"%\\"%g; s%$%\\n%' | tr -d $'\n' | sed -re 's%\\n$%%')",
- "message": "$(git log -1 --pretty=format:%B | sed -re 's%\\%\\\\%g; s%"%\\"%g; s%$%\\n%' | tr -d $'\n' | sed -re 's%\\n$%%')"
- },
- "branch": "$(git rev-parse --abbrev-ref HEAD)",
- "remotes": [
- $(git remote -v | grep 'fetch' | awk '{ print "{\"name\":\""$1"\",\"url\":\""$2"\"}" }' | tr $'\n' ',' | sed -re 's%,$%%')
- ]
- },
- "source_files": [
-EOF
-
-fi
-
-
-for file in $(find * -iname '*.gcov' -print)
-do
- srcname=$(echo ${file} | sed -re 's%#%\/%g; s%.gcov$%%')
- cat >>coverage.json <<EOF
- {
- "name": "${srcname}",
- "source": "$(tail -n +3 ${file} | cut -d ':' -f 3- | sed -re 's%\\%\\\\%g; s%"%\\"%g; s%\t%\\t%g; s%$%\\n%' | tr -d $'\n' | sed -re 's%\\n$%%')",
- "coverage": [$(tail -n +3 ${file} | cut -d ':' -f 1 | sed -re 's%^ +%%g; s%-([0-9]+)%\1%; s%-%null%g; s%^[#=]+$%0%;' | tr $'\n' ',' | sed -re 's%,$%%')]
- },
-EOF
-done
-
-mv coverage.json coverage.json.tmp
-cat >coverage.json <(head -n -1 coverage.json.tmp) <(echo -e " }\n ]\n}")
-rm coverage.json.tmp
-
-curl -F json_file=@coverage.json https://coveralls.io/api/v1/jobs
-
-rm *.gcov
diff --git a/cmake/llvm-cov-wrapper b/cmake/llvm-cov-wrapper
new file mode 100755
index 0000000..eabc491
--- /dev/null
+++ b/cmake/llvm-cov-wrapper
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# This file is part of CMake-codecov.
+#
+# CMake-codecov is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful,but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see
+#
+# http://www.gnu.org/licenses/
+#
+#
+# Copyright (c)
+# 2015-2016 RWTH Aachen University, Federal Republic of Germany
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+if [ -z "$LLVM_COV_BIN" ]
+then
+ echo "LLVM_COV_BIN not set!" >& 2
+ exit 1
+fi
+
+
+# Get LLVM version to find out.
+LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \
+ | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g")
+
+if [ "$1" = "-v" ]
+then
+ echo "llvm-cov-wrapper $LLVM_VERSION"
+ exit 0
+fi
+
+
+if [ -n "$LLVM_VERSION" ]
+then
+ MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1)
+ MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2)
+
+ if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ]
+ then
+ if [ -f "$1" ]
+ then
+ filename=$(basename "$1")
+ extension="${filename##*.}"
+
+ case "$extension" in
+ "gcno") exec $LLVM_COV_BIN --gcno="$1" ;;
+ "gcda") exec $LLVM_COV_BIN --gcda="$1" ;;
+ esac
+ fi
+ fi
+
+ if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ]
+ then
+ exec $LLVM_COV_BIN $@
+ fi
+fi
+
+exec $LLVM_COV_BIN gcov $@
diff --git a/cmake/templates/gammu-config.h.cmake b/cmake/templates/gammu-config.h.cmake
index dbef0de..76083e2 100644
--- a/cmake/templates/gammu-config.h.cmake
+++ b/cmake/templates/gammu-config.h.cmake
@@ -370,14 +370,6 @@
/* Enable Glib */
#cmakedefine Glib_FOUND
-/* MS Visual C++ Express 2005 warnings */
-#if _MSC_VER == 1400
-# pragma warning( disable : 4996 4244 4333)
-# ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
-# define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
-# endif
-#endif
-
/* spawnv argument type */
#cmakedefine SPAWNV_ARGUMENT_IS_CONST
@@ -387,9 +379,6 @@
/* Path where locales will be installed */
#define GAMMU_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@INSTALL_DATA_DIR@"
-/* OpenCellID API key */
-#define OPENCELLID_API_KEY "@OPENCELLID_API_KEY@"
-
/* Most winapi crap can be used as well from Cygwin */
#if defined(WIN32) || defined(__CYGWIN__)
#define HAVE_WINDOWS_SERVICE
diff --git a/cmake/templates/gammu.spec.in b/cmake/templates/gammu.spec.in
index c4796ca..8302353 100644
--- a/cmake/templates/gammu.spec.in
+++ b/cmake/templates/gammu.spec.in
@@ -18,8 +18,8 @@ Group: Hardware/Mobile
%else
Group: Applications/Communications
%endif
-Url: http://wammu.eu/gammu/
-Source0: http://dl.cihar.com/gammu/releases/%{name}-%{version}.tar.%{extension}
+Url: https://wammu.eu/gammu/
+Source0: https://dl.cihar.com/gammu/releases/%{name}-%{version}.tar.%{extension}
# Set to 0 to disable PostgreSQL support
%define pqsql 1