CELIX-417: Adds initial CelixConfig.cmake, export lib/exe target and exporting bundle target
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/ae8e2e3c Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/ae8e2e3c Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/ae8e2e3c Branch: refs/heads/develop Commit: ae8e2e3c6fe14bb3775f7947c26b868966af0921 Parents: 0c64ca6 Author: Pepijn Noltes <[email protected]> Authored: Mon Jan 29 20:59:39 2018 +0100 Committer: Pepijn Noltes <[email protected]> Committed: Mon Jan 29 20:59:39 2018 +0100 ---------------------------------------------------------------------- CMakeLists.txt | 30 ++-- cmake/CMakeCelix.cmake | 31 ---- cmake/CelixConfig.cmake | 71 ++++++++ cmake/CelixConfigVersion.cmake.in | 28 +++ cmake/FindCELIX.cmake | 143 ---------------- cmake/FindCUnit.cmake | 65 ------- cmake/FindCZMQ.cmake | 42 ----- cmake/FindCppUTest.cmake | 54 ------ cmake/FindFFI.cmake | 57 ------- cmake/FindJansson.cmake | 42 ----- cmake/FindSlp.cmake | 42 ----- cmake/FindSyslog.cmake | 26 --- cmake/FindUUID.cmake | 37 ---- cmake/FindZMQ.cmake | 42 ----- cmake/Modules/FindCUnit.cmake | 65 +++++++ cmake/Modules/FindCZMQ.cmake | 42 +++++ cmake/Modules/FindCppUTest.cmake | 54 ++++++ cmake/Modules/FindFFI.cmake | 57 +++++++ cmake/Modules/FindJansson.cmake | 42 +++++ cmake/Modules/FindSlp.cmake | 42 +++++ cmake/Modules/FindSyslog.cmake | 26 +++ cmake/Modules/FindUUID.cmake | 37 ++++ cmake/Modules/FindZMQ.cmake | 42 +++++ cmake/UseDoxygen.cmake | 170 ------------------- cmake/celix_project/ApacheRat.cmake | 30 ++++ cmake/celix_project/CelixProject.cmake | 80 +++++++++ cmake/celix_project/CodeCoverage.cmake | 126 ++++++++++++++ cmake/cmake_celix/ApacheRat.cmake | 30 ---- cmake/cmake_celix/BuildOptions.cmake | 24 --- cmake/cmake_celix/BundlePackaging.cmake | 93 +++++++++- cmake/cmake_celix/CodeCoverage.cmake | 126 -------------- cmake/cmake_celix/Dependencies.cmake | 69 -------- cmake/cmake_celix/DeployPackaging.cmake | 42 ++++- cmake/cmake_celix/UseCelix.cmake | 13 +- dependency_manager/CMakeLists.txt | 4 +- dependency_manager_cxx/CMakeLists.txt | 6 +- examples/CMakeLists.txt | 7 +- examples/dm_example/CMakeLists.txt | 2 +- examples/dm_example/phase3/CMakeLists.txt | 2 +- examples/dm_example_cxx/CMakeLists.txt | 2 +- examples/mongoose/CMakeLists.txt | 2 +- framework/CMakeLists.txt | 4 - log_service/CMakeLists.txt | 1 + log_writer/log_writer_stdout/CMakeLists.txt | 2 +- log_writer/log_writer_syslog/CMakeLists.txt | 2 +- remote_services/topology_manager/CMakeLists.txt | 2 +- shell/CMakeLists.txt | 8 +- shell_tui/CMakeLists.txt | 2 +- 48 files changed, 920 insertions(+), 1046 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index aa26d8e..21117bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,10 +21,8 @@ cmake_policy(SET CMP0042 NEW) project (Celix C CXX) -include(GNUInstallDirs) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") - +include(cmake/celix_project/CelixProject.cmake) +include(cmake/cmake_celix/UseCelix.cmake) # see https://public.kitware.com/Bug/view.php?id=15696 IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 3.3 AND ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") @@ -52,7 +50,6 @@ ENDIF() set(CELIX_MAJOR "1") set(CELIX_MINOR "0") set(CELIX_MICRO "0") -set(CELIX_QUALIFIER "") option(ENABLE_TESTING "Enables unit/bundle testing" FALSE) @@ -60,10 +57,6 @@ if (ENABLE_TESTING) enable_testing() endif() - -include(CMakeCelix) -include(UseDoxygen) - # Default bundle version set(DEFAULT_VERSION 1.0.0) @@ -95,9 +88,22 @@ add_subdirectory(pubsub) add_subdirectory(dependency_manager) add_subdirectory(dependency_manager_cxx) +#Example as last, because some example will check if underlining options are enabled +add_subdirectory(examples) #export targets -install(EXPORT celix NAMESPACE Celix:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/celix) +install(EXPORT celix NAMESPACE Celix:: DESTINATION share/celix/cmake FILE CelixTargets.cmake COMPONENT cmake) +install_celix_bundle_targets(celix NAMESPACE Celix:: DESTINATION share/celix/cmake FILE CelixBundleTargets.cmake COMPONENT cmake) -#Example as last, because some example will check if underlining options are enabled -add_subdirectory(examples) +#install celix cmake modules +install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/Modules/ DESTINATION share/celix/cmake/Modules) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/cmake_celix/ DESTINATION share/celix/cmake/cmake_celix) + +#configure and install CelixConfig and CelixConfigVersion files +configure_file(cmake/CelixConfigVersion.cmake.in + "${PROJECT_BINARY_DIR}/celix/gen/CelixConfigVersion.cmake" @ONLY) + +install(FILES + "cmake/CelixConfig.cmake" + "${PROJECT_BINARY_DIR}/celix/gen/CelixConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/CMake/Celix" COMPONENT cmake) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/CMakeCelix.cmake ---------------------------------------------------------------------- diff --git a/cmake/CMakeCelix.cmake b/cmake/CMakeCelix.cmake deleted file mode 100644 index f67648b..0000000 --- a/cmake/CMakeCelix.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -set(CELIX_CMAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) - -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Dependencies.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/ApacheRat.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/CodeCoverage.cmake) -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BuildOptions.cmake) - -include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/UseCelix.cmake) - -#UseCelix includes: -#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/BundlePackaging.cmake) -#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DeployPackaging.cmake) -#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/DockerPackaging.cmake) -#include(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Runtimes.cmake) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/CelixConfig.cmake ---------------------------------------------------------------------- diff --git a/cmake/CelixConfig.cmake b/cmake/CelixConfig.cmake new file mode 100644 index 0000000..c2d73d7 --- /dev/null +++ b/cmake/CelixConfig.cmake @@ -0,0 +1,71 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# - Config file for the Apache Celix framework +# It defines the following variables +# CELIX_CMAKE_MODULES_DIR - The directory containing the Celix CMake modules +# CELIX_INCLUDE_DIRS - include directories for the Celix framework +# CELIX_LIBRARIES - libraries to link against +# CELIX_LAUNCHER - The Celix launcher + +set(REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..") #from lib/Cmake/Celix + +set(CELIX_CMAKE_MODULES_DIR ${REL_INSTALL_DIR}/share/celix/cmake/Modules) +set(CELIX_FRAMEWORK_INCLUDE_DIR "${REL_INSTALL_DIR}/include/celix") +set(CELIX_UTILS_INCLUDE_DIR "${REL_INSTALL_DIR}/include/utils") +set(CELIX_DFI_INCLUDE_DIR "${REL_INSTALL_DIR}/include/dfi") + +include("${REL_INSTALL_DIR}/share/celix/cmake/cmake_celix/UseCelix.cmake") + +if(NOT TARGET Celix::framework) + include("${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake") + include("${REL_INSTALL_DIR}/share/celix/cmake/CelixBundleTargets.cmake") +endif() + + +# The rest is added to ensure backwards compatiblity with project using the cmake lib/include var instead of targets. +set(CELIX_LIBRARIES Celix::framework Celix::utils Celix::dfi) +set(CELIX_INCLUDE_DIRS + $<TARGET_PROPERTY:Celix::framework,INTERFACE_INCLUDE_DIRECTORIES> + $<TARGET_PROPERTY:Celix::utils, INTERFACE_INCLUDE_DIRECTORIES> + $<TARGET_PROPERTY:Celix::dfi, INTERFACE_INCLUDE_DIRECTORIES> +) + +set(CELIX_FRAMEWORK_LIBRARY Celix::framework) +set(CELIX_UTILS_LIBRARY Celix::utils) +set(CELIX_DFI_LIBRARY Celix::dfi) + +set(CELIX_LAUNCHER Celix::launcher) + +if (TARGET Celix::etcdlib) + set(CELIX_ETCD_INCLUDE_DIRS $<TARGET_PROPERTY:Celix::etcdlib,INTERFACE_INCLUDE_DIRECTORIES>) + set(CELIX_ETCD_LIB Celix::etcdlib) +endif () + +if (TARGET Celix::dependency_manager_so) + set(CELIX_DM_LIB Celix::dependency_manager_so) + set(CELIX_DM_INCLUDE_DIR $<TARGET_PROPERTY:Celix::dependency_manager_so,INTERFACE_INCLUDE_DIRECTORIES>) + set(CELIX_DM_STATIC_LIB Celix::dependency_manager_static) +endif () +if (TARGET Celix::dependency_manager_cxx) + set(CELIX_DM_STATIC_CXX_LIB Celix::dependency_manager_cxx) + set(CELIX_DM_CXX_STATIC_LIB $<TARGET_PROPERTY:Celix::dependency_manager_cxx,INTERFACE_INCLUDE_DIRECTORIES>) +endif () + +set(CELIX_BUNDLES_DIR ${REL_INSTALL_DIR}/share/celix/bundles) +set(CELIX_SHELL_BUNDLE ${CELIX_BUNDLES_DIR}/shell.zip) +set(CELIX_SHELL_TUI_BUNDLE ${CELIX_BUNDLES_DIR}/shell_tui.zip) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/CelixConfigVersion.cmake.in ---------------------------------------------------------------------- diff --git a/cmake/CelixConfigVersion.cmake.in b/cmake/CelixConfigVersion.cmake.in new file mode 100644 index 0000000..60eb8fe --- /dev/null +++ b/cmake/CelixConfigVersion.cmake.in @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set(PACKAGE_VERSION "@CELIX_MAJOR@.@CELIX_MINOR@.@CELIX_MICRO@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindCELIX.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindCELIX.cmake b/cmake/FindCELIX.cmake deleted file mode 100644 index ce31bc9..0000000 --- a/cmake/FindCELIX.cmake +++ /dev/null @@ -1,143 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -# - Try to find Celix define the variables for the binaries/headers and include -# the Celix cmake modules needed to build bundles -# -# Once done this will define -# CELIX_FOUND - System has Apache Celix -# CELIX_INCLUDE_DIRS - The Apache Celix include directories -# CELIX_LIBRARIES - The libraries needed to use Apache Celix (framework,utils and dfi) -# CELIX_LAUNCHER - The path to the celix launcher -# CELIX_FRAMEWORK_LIBRARY - The path to the celix framework library -# CELIX_UTILS_LIBRARY - The path to the celix utils library -# CELIX_DFI_LIBRARY - The path to the celix dfi libary -# -# -# CELIX_BUNDLES_DIR - The path where the Celix provided bundles are installed -# CELIX_DM_LIB - The Celix Dependency Manager library -# CELIX_DM_STATIC_LIB - The Celix Dependency Manager static library -# CELIX_DM_STATIC_CXX_LIB - The Celix C++ Dependency Manager static library - -set(CELIX_DIR_FROM_FINDCELIX "${CMAKE_CURRENT_LIST_DIR}/../../../..") - - -#Find libraries celix_framework, celix_utils, etcdlib and celix_dfi -#Find celix launcher -find_path(CELIX_INCLUDE_DIR NAMES celix_errno.h - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES include include/celix -) - -find_path(CELIX_ETCD_INCLUDE_DIR NAMES etcd.h - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES include include/etcdlib - ) - -find_library(CELIX_FRAMEWORK_LIBRARY NAMES celix_framework - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 -) - -find_library(CELIX_UTILS_LIBRARY NAMES celix_utils - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 -) - -find_library(CELIX_DFI_LIBRARY NAMES celix_dfi - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 -) - -find_program(CELIX_LAUNCHER NAMES celix - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES bin -) - -find_file(CELIX_USECELIX_FILE NAMES UseCelix.cmake - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES share/celix/cmake/modules/cmake_celix -) - - - - -#Finding dependency manager libraries for C and C++ -find_library(CELIX_DM_LIB NAMES dependency_manager_so - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 - ) - -find_library(CELIX_DM_STATIC_LIB NAMES dependency_manager_static - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 - ) - -find_library(CELIX_DM_STATIC_CXX_LIB NAMES dependency_manager_cxx_static - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 - ) - -find_library(CELIX_ETCD_LIB NAMES etcdlib - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES lib lib64 - ) - - -#Finding bundles dir. -find_path(CELIX_BUNDLES_DIR shell.zip #NOTE assuming shell.zip is always installed. - PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local - PATH_SUFFIXES share/celix/bundles -) - -#Finding bundles. If not found the <BUNDLEVAR>_BUNDLE var will be set to <BUNDLEVAR>-NOTFOUND -find_file(CELIX_SHELL_BUNDLE shell.zip - PATHS ${CELIX_BUNDLES_DIR} - NO_DEFAULT_PATH - ) -find_file(CELIX_SHELL_TUI_BUNDLE shell_tui.zip - PATHS ${CELIX_BUNDLES_DIR} - NO_DEFAULT_PATH - ) - - -if (CELIX_DM_STATIC_LIB) - set(CELIX_DM_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager) -endif() -if (CELIX_DM_LIB) - set(CELIX_DM_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager) -endif () -if (CELIX_DM_STATIC_CXX_LIB) - set(CELIX_DM_CXX_STATIC_LIB ${CELIX_DM_STATIC_CXX_LIB}) #Ensure that var name from verion 2.0.0 is still valid - set(CELIX_DM_CXX_INCLUDE_DIR ${CELIX_INCLUDE_DIR}/dependency_manager_cxx) -endif () - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set CELIX_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(CELIX DEFAULT_MSG - CELIX_FRAMEWORK_LIBRARY CELIX_UTILS_LIBRARY CELIX_DFI_LIBRARY CELIX_DM_LIB CELIX_DM_STATIC_LIB CELIX_DM_STATIC_CXX_LIB CELIX_INCLUDE_DIR CELIX_LAUNCHER CELIX_CMAKECELIX_FILE) -mark_as_advanced(CELIX_INCLUDE_DIR CELIX_ETCD_INCLUDE_DIR CELIX_USECELIX_FILE) - -if(CELIX_FOUND) - set(CELIX_LIBRARIES ${CELIX_FRAMEWORK_LIBRARY} ${CELIX_UTILS_LIBRARY} ${CELIX_DFI_LIBRARY}) - set(CELIX_INCLUDE_DIRS ${CELIX_INCLUDE_DIR} ${CELIX_ETCD_INCLUDE_DIR} ${CELIX_DM_INCLUDE_DIR} ${CELIX_DM_CXX_INCLUDE_DIR}) - - include(${CELIX_USECELIX_FILE}) -endif() - http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindCUnit.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindCUnit.cmake b/cmake/FindCUnit.cmake deleted file mode 100644 index 830f551..0000000 --- a/cmake/FindCUnit.cmake +++ /dev/null @@ -1,65 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -if (NOT WIN32) - include(FindCurses) -endif (NOT WIN32) - -FIND_PATH(CUNIT_INCLUDE_DIR CUnit/Basic.h - /usr/local/include - /usr/include - /opt/local/include -) - -FIND_PATH(CUNIT_SHARE_DIR CUnit-List.dtd - /usr/local/share/Cunit - /usr/share/CUnit - /opt/local/share/CUnit -) - -# On unix system, debug and release have the same name -FIND_LIBRARY(CUNIT_LIBRARY cunit - ${CUNIT_INCLUDE_DIR}/../../lib - /usr/local/lib - /usr/lib - ) -FIND_LIBRARY(CUNIT_DEBUG_LIBRARY cunit - ${CUNIT_INCLUDE_DIR}/../../lib - /usr/local/lib - /usr/lib - ) - -IF(CUNIT_INCLUDE_DIR) - IF(CUNIT_LIBRARY) - SET(CUNIT_FOUND "YES") - if (WIN32) - SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY}) - SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY}) - else (WIN32) - SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY} ${CURSES_LIBRARY}) - SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY} ${CURSES_DEBUG_LIBRARY}) - endif (WIN32) - ENDIF(CUNIT_LIBRARY) - IF(CUNIT_INCLUDE_DIR) - if (WIN32) - SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR}) - else (WIN32) - MESSAGE(STATUS "Found CUNIT: ${CUNIT_INCLUDE_DIR}") - SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR} ${CURSES_INCLUDE_DIR}) - endif (WIN32) - ENDIF(CUNIT_INCLUDE_DIR) -ENDIF(CUNIT_INCLUDE_DIR) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindCZMQ.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindCZMQ.cmake b/cmake/FindCZMQ.cmake deleted file mode 100644 index 4f4891c..0000000 --- a/cmake/FindCZMQ.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -# - Try to find CZMQ -# Once done this will define -# CZMQ_FOUND - System has Zmq -# CZMQ_INCLUDE_DIRS - The Zmq include directories -# CZMQ_LIBRARIES - The libraries needed to use Zmq -# CZMQ_DEFINITIONS - Compiler switches required for using Zmq - -find_path(CZMQ_INCLUDE_DIR czmq.h - /usr/include - /usr/local/include ) - -find_library(CZMQ_LIBRARY NAMES czmq - PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ) - -set(CZMQ_LIBRARIES ${CZMQ_LIBRARY} ) -set(CZMQ_INCLUDE_DIRS ${CZMQ_INCLUDE_DIR} ) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set CZMQ_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(Czmq DEFAULT_MSG - CZMQ_LIBRARY CZMQ_INCLUDE_DIR) - -mark_as_advanced(CZMQ_INCLUDE_DIR CZMQ_LIBRARY ) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindCppUTest.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindCppUTest.cmake b/cmake/FindCppUTest.cmake deleted file mode 100644 index 516bc52..0000000 --- a/cmake/FindCppUTest.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -FIND_PATH(CPPUTEST_INCLUDE_DIR NAMES CppUTest/TestHarness.h - PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local - PATH_SUFFIXES include -) - -FIND_PATH(CPPUTEST_EXT_INCLUDE_DIR NAMES CppUTestExt/MockSupport.h - PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local - PATH_SUFFIXES include -) - -FIND_LIBRARY(CPPUTEST_LIBRARY NAMES CppUTest - PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local - PATH_SUFFIXES lib lib64 -) - -FIND_LIBRARY(CPPUTEST_EXT_LIBRARY NAMES CppUTestExt - PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local - PATH_SUFFIXES lib lib64 -) - -# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUTEST DEFAULT_MSG CPPUTEST_LIBRARY CPPUTEST_INCLUDE_DIR) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUTEST_EXT DEFAULT_MSG CPPUTEST_EXT_LIBRARY CPPUTEST_EXT_INCLUDE_DIR) - -mark_as_advanced(CPPUTEST_INCLUDE_DIR CPPUTEST_LIBRARY CPPUTEST_EXT_LIBRARY CPPUTEST_INCLUDE_DIR) - -IF(CPPUTEST_FOUND) - SET(CPPUTEST_LIBRARIES ${CPPUTEST_LIBRARY}) - SET(CPPUTEST_INCLUDE_DIRS ${CPPUTEST_INCLUDE_DIR}) -ENDIF(CPPUTEST_FOUND) - -IF(CPPUTEST_EXT_FOUND) - SET(CPPUTEST_EXT_LIBRARIES ${CPPUTEST_EXT_LIBRARY}) - SET(CPPUTEST_EXT_INCLUDE_DIRS ${CPPUTEST_EXT_INCLUDE_DIR}) -ENDIF(CPPUTEST_EXT_FOUND) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindFFI.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindFFI.cmake b/cmake/FindFFI.cmake deleted file mode 100644 index b94642d..0000000 --- a/cmake/FindFFI.cmake +++ /dev/null @@ -1,57 +0,0 @@ - -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -# - Try to find libffi define the variables for the binaries/headers and include -# -# Once done this will define -# FFI_FOUND - System has libffi -# FFI_INCLUDE_DIRS - The package include directories -# FFI_LIBRARIES - The libraries needed to use this package - -if (NOT WIN32) - # try using pkg-config to get the directories and then use these values - # in the find_path() and find_library() calls - find_package(PkgConfig QUIET) - PKG_CHECK_MODULES(PC_LIBFFI QUIET libffi) -endif () - -mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) - -find_library(FFI_LIBRARY NAMES ffi libffi - PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local - PATH_SUFFIXES lib lib64 x86_64-linux-gnu lib/x86_64-linux-gnu - HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS} -) - -find_path(FFI_INCLUDE_DIR ffi.h - PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local - PATH_SUFFIXES include include/ffi include/x86_64-linux-gnu x86_64-linux-gnu - HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS} -) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set FFI_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(FFI DEFAULT_MSG - FFI_LIBRARY FFI_INCLUDE_DIR) -mark_as_advanced(FFI_INCLUDE_DIR FFI_LIBRARY) - -if(FFI_FOUND) - set(FFI_LIBRARIES ${FFI_LIBRARY}) - set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR}) -endif() http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindJansson.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindJansson.cmake b/cmake/FindJansson.cmake deleted file mode 100644 index bedf8be..0000000 --- a/cmake/FindJansson.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -# - Try to find Jansson -# Once done this will define -# JANSSON_FOUND - System has Jansson -# JANSSON_INCLUDE_DIRS - The Jansson include directories -# JANSSON_LIBRARIES - The libraries needed to use Jansson -# JANSSON_DEFINITIONS - Compiler switches required for using Jansson - -find_path(JANSSON_INCLUDE_DIR jansson.h - /usr/include - /usr/local/include ) - -find_library(JANSSON_LIBRARY NAMES jansson - PATHS /usr/lib /usr/local/lib ) - -set(JANSSON_LIBRARIES ${JANSSON_LIBRARY} ) -set(JANSSON_INCLUDE_DIRS ${JANSSON_INCLUDE_DIR} ) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set JANSSON_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(Jansson DEFAULT_MSG - JANSSON_LIBRARY JANSSON_INCLUDE_DIR) - -mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY ) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindSlp.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindSlp.cmake b/cmake/FindSlp.cmake deleted file mode 100644 index 3461456..0000000 --- a/cmake/FindSlp.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -# - Try to find Slp -# Once done this will define -# SLP_FOUND - System has Slp -# SLP_INCLUDE_DIRS - The Slp include directories -# SLP_LIBRARIES - The libraries needed to use Slp -# SLP_DEFINITIONS - Compiler switches required for using Slp - -find_path(SLP_INCLUDE_DIR slp.h - /usr/include - /usr/local/include ) - -find_library(SLP_LIBRARY NAMES slp - PATHS /usr/lib /usr/local/lib ) - -set(SLP_LIBRARIES ${SLP_LIBRARY} ) -set(SLP_INCLUDE_DIRS ${SLP_INCLUDE_DIR} ) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set SLP_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(Slp DEFAULT_MSG - SLP_LIBRARY SLP_INCLUDE_DIR) - -mark_as_advanced(SLP_INCLUDE_DIR SLP_LIBRARY ) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindSyslog.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindSyslog.cmake b/cmake/FindSyslog.cmake deleted file mode 100644 index 769b806..0000000 --- a/cmake/FindSyslog.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -find_path(SYSLOG_INCLUDE_DIR syslog.h /usr/include) - -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args(Syslog DEFAULT_MSG - SYSLOG_INCLUDE_DIR) - -mark_as_advanced(SYSLOG_INCLUDE_DIR) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindUUID.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindUUID.cmake b/cmake/FindUUID.cmake deleted file mode 100644 index 63bfafb..0000000 --- a/cmake/FindUUID.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -find_path(UUID_INCLUDE_DIR uuid/uuid.h - /usr/include - /usr/local/include ) - -find_library(UUID_LIBRARY NAMES uuid - PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu) - -include(FindPackageHandleStandardArgs) -if (APPLE) -find_package_handle_standard_args(UUID DEFAULT_MSG - UUID_INCLUDE_DIR) -else () -find_package_handle_standard_args(UUID DEFAULT_MSG - UUID_LIBRARY UUID_INCLUDE_DIR) -endif () - - -mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY) - http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/FindZMQ.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindZMQ.cmake b/cmake/FindZMQ.cmake deleted file mode 100644 index b2c2663..0000000 --- a/cmake/FindZMQ.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -# - Try to find ZMQ -# Once done this will define -# ZMQ_FOUND - System has Zmq -# ZMQ_INCLUDE_DIRS - The Zmq include directories -# ZMQ_LIBRARIES - The libraries needed to use Zmq -# ZMQ_DEFINITIONS - Compiler switches required for using Zmq - -find_path(ZMQ_INCLUDE_DIR zmq.h zmq_utils.h - /usr/include - /usr/local/include ) - -find_library(ZMQ_LIBRARY NAMES zmq - PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ) - -set(ZMQ_LIBRARIES ${ZMQ_LIBRARY} ) -set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR} ) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(Zmq DEFAULT_MSG - ZMQ_LIBRARY ZMQ_INCLUDE_DIR) - -mark_as_advanced(ZMQ_INCLUDE_DIR ZMQ_LIBRARY ) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindCUnit.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindCUnit.cmake b/cmake/Modules/FindCUnit.cmake new file mode 100644 index 0000000..830f551 --- /dev/null +++ b/cmake/Modules/FindCUnit.cmake @@ -0,0 +1,65 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (NOT WIN32) + include(FindCurses) +endif (NOT WIN32) + +FIND_PATH(CUNIT_INCLUDE_DIR CUnit/Basic.h + /usr/local/include + /usr/include + /opt/local/include +) + +FIND_PATH(CUNIT_SHARE_DIR CUnit-List.dtd + /usr/local/share/Cunit + /usr/share/CUnit + /opt/local/share/CUnit +) + +# On unix system, debug and release have the same name +FIND_LIBRARY(CUNIT_LIBRARY cunit + ${CUNIT_INCLUDE_DIR}/../../lib + /usr/local/lib + /usr/lib + ) +FIND_LIBRARY(CUNIT_DEBUG_LIBRARY cunit + ${CUNIT_INCLUDE_DIR}/../../lib + /usr/local/lib + /usr/lib + ) + +IF(CUNIT_INCLUDE_DIR) + IF(CUNIT_LIBRARY) + SET(CUNIT_FOUND "YES") + if (WIN32) + SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY}) + SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY}) + else (WIN32) + SET(CUNIT_LIBRARIES ${CUNIT_LIBRARY} ${CURSES_LIBRARY}) + SET(CUNIT_DEBUG_LIBRARIES ${CUNIT_DEBUG_LIBRARY} ${CURSES_DEBUG_LIBRARY}) + endif (WIN32) + ENDIF(CUNIT_LIBRARY) + IF(CUNIT_INCLUDE_DIR) + if (WIN32) + SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR}) + else (WIN32) + MESSAGE(STATUS "Found CUNIT: ${CUNIT_INCLUDE_DIR}") + SET(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR} ${CURSES_INCLUDE_DIR}) + endif (WIN32) + ENDIF(CUNIT_INCLUDE_DIR) +ENDIF(CUNIT_INCLUDE_DIR) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindCZMQ.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindCZMQ.cmake b/cmake/Modules/FindCZMQ.cmake new file mode 100644 index 0000000..4f4891c --- /dev/null +++ b/cmake/Modules/FindCZMQ.cmake @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# - Try to find CZMQ +# Once done this will define +# CZMQ_FOUND - System has Zmq +# CZMQ_INCLUDE_DIRS - The Zmq include directories +# CZMQ_LIBRARIES - The libraries needed to use Zmq +# CZMQ_DEFINITIONS - Compiler switches required for using Zmq + +find_path(CZMQ_INCLUDE_DIR czmq.h + /usr/include + /usr/local/include ) + +find_library(CZMQ_LIBRARY NAMES czmq + PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ) + +set(CZMQ_LIBRARIES ${CZMQ_LIBRARY} ) +set(CZMQ_INCLUDE_DIRS ${CZMQ_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set CZMQ_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(Czmq DEFAULT_MSG + CZMQ_LIBRARY CZMQ_INCLUDE_DIR) + +mark_as_advanced(CZMQ_INCLUDE_DIR CZMQ_LIBRARY ) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindCppUTest.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindCppUTest.cmake b/cmake/Modules/FindCppUTest.cmake new file mode 100644 index 0000000..516bc52 --- /dev/null +++ b/cmake/Modules/FindCppUTest.cmake @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +FIND_PATH(CPPUTEST_INCLUDE_DIR NAMES CppUTest/TestHarness.h + PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local + PATH_SUFFIXES include +) + +FIND_PATH(CPPUTEST_EXT_INCLUDE_DIR NAMES CppUTestExt/MockSupport.h + PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local + PATH_SUFFIXES include +) + +FIND_LIBRARY(CPPUTEST_LIBRARY NAMES CppUTest + PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local + PATH_SUFFIXES lib lib64 +) + +FIND_LIBRARY(CPPUTEST_EXT_LIBRARY NAMES CppUTestExt + PATHS $ENV{CPPUTEST_DIR} ${CPPUTEST_DIR} /usr /usr/local /opt/local + PATH_SUFFIXES lib lib64 +) + +# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUTEST DEFAULT_MSG CPPUTEST_LIBRARY CPPUTEST_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUTEST_EXT DEFAULT_MSG CPPUTEST_EXT_LIBRARY CPPUTEST_EXT_INCLUDE_DIR) + +mark_as_advanced(CPPUTEST_INCLUDE_DIR CPPUTEST_LIBRARY CPPUTEST_EXT_LIBRARY CPPUTEST_INCLUDE_DIR) + +IF(CPPUTEST_FOUND) + SET(CPPUTEST_LIBRARIES ${CPPUTEST_LIBRARY}) + SET(CPPUTEST_INCLUDE_DIRS ${CPPUTEST_INCLUDE_DIR}) +ENDIF(CPPUTEST_FOUND) + +IF(CPPUTEST_EXT_FOUND) + SET(CPPUTEST_EXT_LIBRARIES ${CPPUTEST_EXT_LIBRARY}) + SET(CPPUTEST_EXT_INCLUDE_DIRS ${CPPUTEST_EXT_INCLUDE_DIR}) +ENDIF(CPPUTEST_EXT_FOUND) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindFFI.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindFFI.cmake b/cmake/Modules/FindFFI.cmake new file mode 100644 index 0000000..b94642d --- /dev/null +++ b/cmake/Modules/FindFFI.cmake @@ -0,0 +1,57 @@ + +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# - Try to find libffi define the variables for the binaries/headers and include +# +# Once done this will define +# FFI_FOUND - System has libffi +# FFI_INCLUDE_DIRS - The package include directories +# FFI_LIBRARIES - The libraries needed to use this package + +if (NOT WIN32) + # try using pkg-config to get the directories and then use these values + # in the find_path() and find_library() calls + find_package(PkgConfig QUIET) + PKG_CHECK_MODULES(PC_LIBFFI QUIET libffi) +endif () + +mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) + +find_library(FFI_LIBRARY NAMES ffi libffi + PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local + PATH_SUFFIXES lib lib64 x86_64-linux-gnu lib/x86_64-linux-gnu + HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS} +) + +find_path(FFI_INCLUDE_DIR ffi.h + PATHS $ENV{FFI_DIR} ${FFI_DIR} /usr /usr/local /opt/local + PATH_SUFFIXES include include/ffi include/x86_64-linux-gnu x86_64-linux-gnu + HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS} +) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set FFI_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(FFI DEFAULT_MSG + FFI_LIBRARY FFI_INCLUDE_DIR) +mark_as_advanced(FFI_INCLUDE_DIR FFI_LIBRARY) + +if(FFI_FOUND) + set(FFI_LIBRARIES ${FFI_LIBRARY}) + set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR}) +endif() http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindJansson.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindJansson.cmake b/cmake/Modules/FindJansson.cmake new file mode 100644 index 0000000..bedf8be --- /dev/null +++ b/cmake/Modules/FindJansson.cmake @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# - Try to find Jansson +# Once done this will define +# JANSSON_FOUND - System has Jansson +# JANSSON_INCLUDE_DIRS - The Jansson include directories +# JANSSON_LIBRARIES - The libraries needed to use Jansson +# JANSSON_DEFINITIONS - Compiler switches required for using Jansson + +find_path(JANSSON_INCLUDE_DIR jansson.h + /usr/include + /usr/local/include ) + +find_library(JANSSON_LIBRARY NAMES jansson + PATHS /usr/lib /usr/local/lib ) + +set(JANSSON_LIBRARIES ${JANSSON_LIBRARY} ) +set(JANSSON_INCLUDE_DIRS ${JANSSON_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set JANSSON_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(Jansson DEFAULT_MSG + JANSSON_LIBRARY JANSSON_INCLUDE_DIR) + +mark_as_advanced(JANSSON_INCLUDE_DIR JANSSON_LIBRARY ) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindSlp.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindSlp.cmake b/cmake/Modules/FindSlp.cmake new file mode 100644 index 0000000..3461456 --- /dev/null +++ b/cmake/Modules/FindSlp.cmake @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# - Try to find Slp +# Once done this will define +# SLP_FOUND - System has Slp +# SLP_INCLUDE_DIRS - The Slp include directories +# SLP_LIBRARIES - The libraries needed to use Slp +# SLP_DEFINITIONS - Compiler switches required for using Slp + +find_path(SLP_INCLUDE_DIR slp.h + /usr/include + /usr/local/include ) + +find_library(SLP_LIBRARY NAMES slp + PATHS /usr/lib /usr/local/lib ) + +set(SLP_LIBRARIES ${SLP_LIBRARY} ) +set(SLP_INCLUDE_DIRS ${SLP_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set SLP_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(Slp DEFAULT_MSG + SLP_LIBRARY SLP_INCLUDE_DIR) + +mark_as_advanced(SLP_INCLUDE_DIR SLP_LIBRARY ) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindSyslog.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindSyslog.cmake b/cmake/Modules/FindSyslog.cmake new file mode 100644 index 0000000..769b806 --- /dev/null +++ b/cmake/Modules/FindSyslog.cmake @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +find_path(SYSLOG_INCLUDE_DIR syslog.h /usr/include) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Syslog DEFAULT_MSG + SYSLOG_INCLUDE_DIR) + +mark_as_advanced(SYSLOG_INCLUDE_DIR) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindUUID.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindUUID.cmake b/cmake/Modules/FindUUID.cmake new file mode 100644 index 0000000..63bfafb --- /dev/null +++ b/cmake/Modules/FindUUID.cmake @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +find_path(UUID_INCLUDE_DIR uuid/uuid.h + /usr/include + /usr/local/include ) + +find_library(UUID_LIBRARY NAMES uuid + PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu) + +include(FindPackageHandleStandardArgs) +if (APPLE) +find_package_handle_standard_args(UUID DEFAULT_MSG + UUID_INCLUDE_DIR) +else () +find_package_handle_standard_args(UUID DEFAULT_MSG + UUID_LIBRARY UUID_INCLUDE_DIR) +endif () + + +mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY) + http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/Modules/FindZMQ.cmake ---------------------------------------------------------------------- diff --git a/cmake/Modules/FindZMQ.cmake b/cmake/Modules/FindZMQ.cmake new file mode 100644 index 0000000..b2c2663 --- /dev/null +++ b/cmake/Modules/FindZMQ.cmake @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# - Try to find ZMQ +# Once done this will define +# ZMQ_FOUND - System has Zmq +# ZMQ_INCLUDE_DIRS - The Zmq include directories +# ZMQ_LIBRARIES - The libraries needed to use Zmq +# ZMQ_DEFINITIONS - Compiler switches required for using Zmq + +find_path(ZMQ_INCLUDE_DIR zmq.h zmq_utils.h + /usr/include + /usr/local/include ) + +find_library(ZMQ_LIBRARY NAMES zmq + PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 ) + +set(ZMQ_LIBRARIES ${ZMQ_LIBRARY} ) +set(ZMQ_INCLUDE_DIRS ${ZMQ_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set ZMQ_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(Zmq DEFAULT_MSG + ZMQ_LIBRARY ZMQ_INCLUDE_DIR) + +mark_as_advanced(ZMQ_INCLUDE_DIR ZMQ_LIBRARY ) http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/UseDoxygen.cmake ---------------------------------------------------------------------- diff --git a/cmake/UseDoxygen.cmake b/cmake/UseDoxygen.cmake deleted file mode 100644 index 376dbe2..0000000 --- a/cmake/UseDoxygen.cmake +++ /dev/null @@ -1,170 +0,0 @@ -# Redistribution and use is allowed according to the terms of the New -# BSD license: -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# - Run Doxygen -# -# Adds a doxygen target that runs doxygen to generate the html -# and optionally the LaTeX API documentation. -# The doxygen target is added to the doc target as a dependency. -# i.e.: the API documentation is built with: -# make doc -# -# USAGE: GLOBAL INSTALL -# -# Install it with: -# cmake ./ && sudo make install -# Add the following to the CMakeLists.txt of your project: -# include(UseDoxygen OPTIONAL) -# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it. -# -# USAGE: INCLUDE IN PROJECT -# -# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) -# include(UseDoxygen) -# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory. -# -# -# CONFIGURATION -# -# To configure Doxygen you can edit Doxyfile.in and set some variables in cmake. -# Variables you may define are: -# DOXYFILE_SOURCE_DIR - Path where the Doxygen input files are. -# Defaults to the current source directory. -# DOXYFILE_EXTRA_SOURCES - Additional source diretories/files for Doxygen to scan. -# The Paths should be in double quotes and separated by space. e.g.: -# "${CMAKE_CURRENT_BINARY_DIR}/foo.c" "${CMAKE_CURRENT_BINARY_DIR}/bar/" -# -# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. -# Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doc". -# -# DOXYFILE_LATEX - ON/OFF; Set to "ON" if you want the LaTeX documentation -# to be built. -# DOXYFILE_LATEX_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where -# the Doxygen LaTeX output is stored. Defaults to "latex". -# -# DOXYFILE_HTML_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where -# the Doxygen html output is stored. Defaults to "html". -# - -# -# Copyright (c) 2009, 2010, 2011 Tobias Rautenkranz <[email protected]> -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# - -macro(usedoxygen_set_default name value type docstring) - if(NOT DEFINED "${name}") - set("${name}" "${value}" CACHE "${type}" "${docstring}") - endif() -endmacro() - -find_package(Doxygen) - -if(DOXYGEN_FOUND) - find_file(DOXYFILE_IN "Doxyfile.in" - PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/" - NO_DEFAULT_PATH - DOC "Path to the doxygen configuration template file") - set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN") -endif() - -if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND) - usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc" - PATH "Doxygen output directory") - usedoxygen_set_default(DOXYFILE_HTML_DIR "html" - STRING "Doxygen HTML output directory") - usedoxygen_set_default(DOXYFILE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" - PATH "Input files source directory") - usedoxygen_set_default(DOXYFILE_EXTRA_SOURCE_DIRS "" - STRING "Additional source files/directories separated by space") - set(DOXYFILE_SOURE_DIRS "\"${DOXYFILE_SOURCE_DIR}\" ${DOXYFILE_EXTRA_SOURCES}") - - usedoxygen_set_default(DOXYFILE_LATEX YES BOOL "Generate LaTeX API documentation" OFF) - usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex" STRING "LaTex output directory") - - mark_as_advanced(DOXYFILE_OUTPUT_DIR DOXYFILE_HTML_DIR DOXYFILE_LATEX_DIR - DOXYFILE_SOURCE_DIR DOXYFILE_EXTRA_SOURCE_DIRS DOXYFILE_IN) - - - set_property(DIRECTORY - APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES - "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}") - - add_custom_target(doxygen - COMMAND "${DOXYGEN_EXECUTABLE}" - "${DOXYFILE}" - COMMENT "Writing documentation to ${DOXYFILE_OUTPUT_DIR}..." - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") - - ## LaTeX - set(DOXYFILE_PDFLATEX "NO") - set(DOXYFILE_DOT "NO") - - set_property(DIRECTORY APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES - "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}") - - if(DOXYFILE_LATEX STREQUAL "ON") - set(DOXYFILE_GENERATE_LATEX "YES") - find_package(LATEX) - find_program(DOXYFILE_MAKE make) - mark_as_advanced(DOXYFILE_MAKE) - if(LATEX_COMPILER AND MAKEINDEX_COMPILER AND DOXYFILE_MAKE) - if(PDFLATEX_COMPILER) - set(DOXYFILE_PDFLATEX "YES") - endif() - if(DOXYGEN_DOT_EXECUTABLE) - set(DOXYFILE_DOT "YES") - endif() - - add_custom_command(TARGET doxygen - POST_BUILD - COMMAND "${DOXYFILE_MAKE}" - COMMENT "Running LaTeX for Doxygen documentation in ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}..." - WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}") - else() - set(DOXYGEN_LATEX "NO") - endif() - else() - set(DOXYFILE_GENERATE_LATEX "NO") - endif() - - - configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY) - - if(TARGET doc) - get_target_property(DOC_TARGET doc TYPE) - endif() - if(NOT DOC_TARGET) - add_custom_target(doc) - endif() - - add_dependencies(doc doxygen) -endif() http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/celix_project/ApacheRat.cmake ---------------------------------------------------------------------- diff --git a/cmake/celix_project/ApacheRat.cmake b/cmake/celix_project/ApacheRat.cmake new file mode 100644 index 0000000..f35cab7 --- /dev/null +++ b/cmake/celix_project/ApacheRat.cmake @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +find_package(Java COMPONENTS Runtime) + +if(Java_Runtime_FOUND) + set(APACHE_RAT "NOT_FOUND" CACHE FILEPATH "Full path to the Apache RAT JAR file") + + add_custom_target(rat + COMMAND ${Java_JAVA_EXECUTABLE} -jar ${APACHE_RAT} -E rat-excludes.txt -d . + + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) +else(Java_Runtime_FOUND) + MESSAGE(STATUS "Java not found, cannot execute Apache RAT checks") +endif(Java_Runtime_FOUND) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/celix_project/CelixProject.cmake ---------------------------------------------------------------------- diff --git a/cmake/celix_project/CelixProject.cmake b/cmake/celix_project/CelixProject.cmake new file mode 100644 index 0000000..490c359 --- /dev/null +++ b/cmake/celix_project/CelixProject.cmake @@ -0,0 +1,80 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +option(ENABLE_ADDRESS_SANITIZER "Enabled building with address sanitizer. Note for gcc libasan must be installed" OFF) + +if (ENABLE_ADDRESS_SANITIZER) + set(CMAKE_C_FLAGS "-lasan -fsanitize=address ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-lasan -fsanitize=address ${CMAKE_CXX_FLAGS}") +endif() + + +MACRO(celix_subproject) + set(ARGS "${ARGN}") + + list(GET ARGS 0 OPTION_NAME) + list(REMOVE_AT ARGS 0) + + list(GET ARGS 0 OPTION_DESCRIPTION) + list(REMOVE_AT ARGS 0) + + list(GET ARGS 0 OPTION_DEFAULT) + list(REMOVE_AT ARGS 0) + + set(OPTIONS ) + set(ONE_VAL_ARGS ) + set(MULTI_VAL_ARGS DEPS) + cmake_parse_arguments(OPTION "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGS}) + + string(TOUPPER ${OPTION_NAME} UC_OPTION_NAME) + set(NAME "BUILD_${UC_OPTION_NAME}") + + option(${NAME} "${OPTION_DESCRIPTION}" ${OPTION_DEFAULT}) + + get_property(BUILD GLOBAL PROPERTY ${NAME}_INTERNAL) + if (NOT DEFINED BUILD) + set(BUILD "OFF") + endif (NOT DEFINED BUILD) + + IF (${NAME} OR ${BUILD}) + set(${OPTION_NAME} "ON") + set_property(GLOBAL PROPERTY ${NAME}_INTERNAL "ON") + + FOREACH (DEP ${OPTION_DEPS}) + string(TOUPPER ${DEP} UC_DEP) + set(DEP_NAME "BUILD_${UC_DEP}") + set_property(GLOBAL PROPERTY ${DEP_NAME}_INTERNAL "ON") + ENDFOREACH (DEP) + ELSE (${NAME} OR ${BUILD}) + set(${OPTION_NAME} "OFF") + ENDIF (${NAME} OR ${BUILD}) +ENDMACRO(celix_subproject) + +MACRO(is_enabled name) + string(TOUPPER "BUILD_${name}_INTERNAL" OPTION) + + get_property(BUILD GLOBAL PROPERTY ${OPTION}) + + if(BUILD) + set(${name} "ON") + else() + set(${name} "OFF") + endif() +ENDMACRO(is_enabled) + +include(${CMAKE_CURRENT_LIST_DIR}/ApacheRat.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CodeCoverage.cmake) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/celix_project/CodeCoverage.cmake ---------------------------------------------------------------------- diff --git a/cmake/celix_project/CodeCoverage.cmake b/cmake/celix_project/CodeCoverage.cmake new file mode 100644 index 0000000..51b5001 --- /dev/null +++ b/cmake/celix_project/CodeCoverage.cmake @@ -0,0 +1,126 @@ +# Boost Software License - Version 1.0 - August 17th, 2003 +# +# Permission is hereby granted, free of charge, to any person or organization +# obtaining a copy of the software and accompanying documentation covered by +# this license (the "Software") to use, reproduce, display, distribute, +# execute, and transmit the Software, and to prepare derivative works of the +# Software, and to permit third-parties to whom the Software is furnished to +# do so, all subject to the following: +# +# The copyright notices in the Software and this entire statement, including +# the above license grant, this restriction and the following disclaimer, +# must be included in all copies of the Software, in whole or in part, and +# all derivative works of the Software, unless such copies or derivative +# works are solely in the form of machine-executable object code generated by +# a source language processor. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +# - Enable Code Coverage +# +# 2012-01-31, Lars Bilke +# +# USAGE: +# 1. Copy this file into your cmake modules path +# 2. Add the following line to your CMakeLists.txt: +# INCLUDE(CodeCoverage) +# +# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target +# which runs your test executable and produces a lcov code coverage report. +# + +# - Changes made by Celix +# 1. Added compiler options using --coverage instead of GCC specific strings +# 2. Added custom target to generate HTML pages for combined coverage results +# 3. Added each coverage target to the overall "coverage" target +# 4. Added "mock" to exclude list for coverage results +# 5. Removed HTML generation from the coverage setup function +# 6. Removed unneeded Cobertura function +# + +# Option to enable/disable coverage +option(ENABLE_CODE_COVERAGE "Enables code coverage" FALSE) + +# Check if coverage is enabled +IF(ENABLE_CODE_COVERAGE) + + # Check prereqs + FIND_PROGRAM( GCOV_PATH gcov ) + FIND_PROGRAM( LCOV_PATH lcov ) + FIND_PROGRAM( GENHTML_PATH genhtml ) + FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) + + IF(NOT GCOV_PATH) + MESSAGE(FATAL_ERROR "gcov not found! Aborting...") + ENDIF() # NOT GCOV_PATH + + #IF(NOT CMAKE_COMPILER_IS_GNUCXX) + # MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") + #ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX + + IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) + MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" ) + ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" + + # Setup compiler options + ADD_DEFINITIONS(--coverage) + set(CMAKE_SHARED_LINKER_FLAGS "--coverage") + set(CMAKE_EXE_LINKER_FLAGS "--coverage") + + IF(NOT TARGET coverage) + add_custom_target(coverage + COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results + COMMAND ${GENHTML_PATH} -o coverage_results coverage/*/*.info.cleaned + + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to view the coverage report." + ) + + SET_TARGET_PROPERTIES(coverage PROPERTIES COVERAGE_TARGET_ADDED "") + ENDIF() + +ENDIF(ENABLE_CODE_COVERAGE) + +# Param _targetname The name of new the custom make target +# Param _testrunner The name of the target which runs the tests +# Param _outputname lcov output is generated as _outputname.info +# HTML report is generated in _outputname/index.html +# Optional fourth parameter is passed as arguments to _testrunner +# Pass them in list form, e.g.: "-j;2" for -j 2 +FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) + IF(ENABLE_CODE_COVERAGE) + IF(NOT LCOV_PATH) + MESSAGE(FATAL_ERROR "lcov not found! Aborting...") + ENDIF() # NOT LCOV_PATH + + IF(NOT GENHTML_PATH) + MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") + ENDIF() # NOT GENHTML_PATH + + # Setup target + ADD_CUSTOM_TARGET(${_targetname}_coverage + + # Cleanup lcov + ${LCOV_PATH} --directory . --zerocounters + + # Run tests + COMMAND ${_testrunner} ${ARGV3} + + # Capturing lcov counters and generating report + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage/${_testrunner} + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info + COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'mock/*' 'test/*' '/usr/*' --output-file ${_outputname}.info.cleaned + + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." + ) + ADD_DEPENDENCIES(coverage ${_targetname}_coverage) + ENDIF(ENABLE_CODE_COVERAGE) +ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/cmake_celix/ApacheRat.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/ApacheRat.cmake b/cmake/cmake_celix/ApacheRat.cmake deleted file mode 100644 index f35cab7..0000000 --- a/cmake/cmake_celix/ApacheRat.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -find_package(Java COMPONENTS Runtime) - -if(Java_Runtime_FOUND) - set(APACHE_RAT "NOT_FOUND" CACHE FILEPATH "Full path to the Apache RAT JAR file") - - add_custom_target(rat - COMMAND ${Java_JAVA_EXECUTABLE} -jar ${APACHE_RAT} -E rat-excludes.txt -d . - - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) -else(Java_Runtime_FOUND) - MESSAGE(STATUS "Java not found, cannot execute Apache RAT checks") -endif(Java_Runtime_FOUND) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/cmake_celix/BuildOptions.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/BuildOptions.cmake b/cmake/cmake_celix/BuildOptions.cmake deleted file mode 100644 index 7420cd0..0000000 --- a/cmake/cmake_celix/BuildOptions.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - - -option(ENABLE_ADDRESS_SANITIZER "Enabled building with address sanitizer. Note for gcc libasan must be installed" OFF) - -if (ENABLE_ADDRESS_SANITIZER) - set(CMAKE_C_FLAGS "-lasan -fsanitize=address ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-lasan -fsanitize=address ${CMAKE_CXX_FLAGS}") -endif() http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/cmake_celix/BundlePackaging.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/BundlePackaging.cmake b/cmake/cmake_celix/BundlePackaging.cmake index 44e7382..1196912 100644 --- a/cmake/cmake_celix/BundlePackaging.cmake +++ b/cmake/cmake_celix/BundlePackaging.cmake @@ -168,7 +168,7 @@ function(add_celix_bundle) ##### MANIFEST configuration and generation ################## #Step1 configure the file so that the target name is present in in the template - configure_file(${CELIX_CMAKE_DIRECTORY}/cmake_celix/Manifest.template.in ${BUNDLE_GEN_DIR}/MANIFEST.step1) + configure_file(${CELIX_CMAKE_DIRECTORY}/Manifest.template.in ${BUNDLE_GEN_DIR}/MANIFEST.step1) #Step2 replace headers with target property values. Note this is done build time file(GENERATE @@ -222,7 +222,8 @@ function(add_celix_bundle) set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IS_BUNDLE_TARGET" TRUE) #indicate that this is a bundle target set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_DEPEND_TARGETS" "") #bundle target dependencies. Note can be extended after the add_bundle call set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_GEN_DIR" ${BUNDLE_GEN_DIR}) #location for generated output. - set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CREATE_BUNDLE_TARGET" ${BUNDLE_TARGET_NAME}_bundle) + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CREATE_BUNDLE_TARGET" ${BUNDLE_TARGET_NAME}_bundle) #target which creat the bundle zip + set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_IMPORTED" FALSE) #whethet target is a imported (bundle) target #bundle specific set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_CONTENT_DIR" ${BUNDLE_CONTENT_DIR}) #location where the content to be jar/zipped. @@ -482,7 +483,7 @@ function(install_celix_bundle) list(REMOVE_AT ARGN 0) set(OPTIONS ) - set(ONE_VAL_ARGS PROJECT_NAME BUNDLE_NAME) + set(ONE_VAL_ARGS PROJECT_NAME BUNDLE_NAME EXPORT) set(MULTI_VAL_ARGS HEADERS RESOURCES) cmake_parse_arguments(INSTALL "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) @@ -494,6 +495,23 @@ function(install_celix_bundle) endif() install(FILES "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" DESTINATION share/${INSTALL_PROJECT_NAME}/bundles COMPONENT ${BUNDLE}) + + if (INSTALL_EXPORT) + get_target_property(CURRENT_EXPORT_BUNDLES celix-bundles EXPORT_${INSTALL_EXPORT}_BUNDLES) + + if (NOT CURRENT_EXPORT_BUNDLES) + set(CURRENT_EXPORT_BUNDLES ${BUNDLE}) + else () + list(APPEND CURRENT_EXPORT_BUNDLES ${BUNDLE}) + endif () + + list(REMOVE_DUPLICATES CURRENT_EXPORT_BUNDLES) + + set_target_properties(celix-bundles PROPERTIES + EXPORT_${INSTALL_EXPORT}_BUNDLES "${CURRENT_EXPORT_BUNDLES}" + ) + endif () + if(INSTALL_HEADERS) install (FILES ${INSTALL_HEADERS} DESTINATION include/${INSTALL_PROJECT_NAME}/${INSTALL_BUNDLE_NAME} COMPONENT ${BUNDLE}) endif() @@ -502,3 +520,72 @@ function(install_celix_bundle) endif() endfunction() + +function(install_celix_bundle_targets) + #0 is the export name + list(GET ARGN 0 EXPORT_NAME) + list(REMOVE_AT ARGN 0) + + set(OPTIONS ) + set(ONE_VAL_ARGS NAMESPACE DESTINATION FILE COMPONENT PROJECT_NAME) + set(MULTI_VAL_ARGS ) + cmake_parse_arguments(EXPORT "${OPTIONS}" "${ONE_VAL_ARGS}" "${MULTI_VAL_ARGS}" ${ARGN}) + + get_target_property(EXPORT_BUNDLES celix-bundles EXPORT_${EXPORT_NAME}_BUNDLES) + + if (NOT EXPORT_BUNDLES) + message(FATAL_ERROR "Export ${EXPORT_NAME} not defined. Did you forgot to use a install_celix_bundle with the 'EXPORT ${EXPORT_NAME}' option?") + endif () + + if (NOT EXPORT_FILE) + set(EXPORT_FILE ${EXPORT_NAME}BundleTargets.cmake) + endif () + if (NOT EXPORT_PROJECT_NAME) + string(TOLOWER ${PROJECT_NAME} EXPORT_PROJECT_NAME) + endif() + if (NOT EXPORT_DESTINATION) + set(EXPORT_DESTINATION share/${EXPORT_PROJECT_NAME}/cmake) + endif () + if (EXPORT_COMPONENT) + set(CMP_OPT "COMPONENT ${EXPORT_COMPONENT}") + endif () + + #extract number of .. needed ot reach install prefix (e.g. howto calculte _IMPORT_PREFIX + file(TO_CMAKE_PATH ${EXPORT_DESTINATION} DEST_PATH) + string(REGEX MATCHALL "/" SLASH_MATCHES ${DEST_PATH}) + list(LENGTH SLASH_MATCHES NR_OF_SUB_DIRS) + + set(CONF_IN_FILE "${CMAKE_BINARY_DIR}/celix/gen/${EXPORT_NAME}-ImportedBundleTargets.cmake.in") + set(CONF_FILE "${CMAKE_BINARY_DIR}/celix/gen/${EXPORT_NAME}-ImportedBundleTargets.cmake") + file(REMOVE "${CONF_IN_FILE}") + + + file(APPEND "${CONF_IN_FILE}" "# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH) +") + foreach(_VAR RANGE ${NR_OF_SUB_DIRS}) + file(APPEND "${CONF_IN_FILE}" "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH) +") + endforeach() + file(APPEND "${CONF_IN_FILE}" " +") + + foreach(BUNDLE_TARGET IN LISTS EXPORT_BUNDLES) + set(TN "${EXPORT_NAMESPACE}${BUNDLE_TARGET}") + file(APPEND "${CONF_IN_FILE}" " +add_library(${TN} SHARED IMPORTED) +set_target_properties(${TN} PROPERTIES + BUNDLE_IMPORTED TRUE + BUNDLE_FILE \"\${_IMPORT_PREFIX}/share/${EXPORT_PROJECT_NAME}/bundles/$<TARGET_PROPERTY:${BUNDLE_TARGET},BUNDLE_FILENAME>\" + BUNDLE_FILENAME \"$<TARGET_PROPERTY:${BUNDLE_TARGET},BUNDLE_FILENAME>\" +) +") + endforeach() + file(GENERATE OUTPUT "${CONF_FILE}" INPUT "${CONF_IN_FILE}") + + if (EXPORT_COMPONENT) + install(FILES "${CONF_FILE}" DESTINATION ${EXPORT_DESTINATION} RENAME ${EXPORT_FILE} COMPONENT ${EXPORT_COMPONENT}) + else () + install(FILES "${CONF_FILE}" DESTINATION ${EXPORT_DESTINATION} RENAME ${EXPORT_FILE}) + endif () +endfunction() http://git-wip-us.apache.org/repos/asf/celix/blob/ae8e2e3c/cmake/cmake_celix/CodeCoverage.cmake ---------------------------------------------------------------------- diff --git a/cmake/cmake_celix/CodeCoverage.cmake b/cmake/cmake_celix/CodeCoverage.cmake deleted file mode 100644 index 51b5001..0000000 --- a/cmake/cmake_celix/CodeCoverage.cmake +++ /dev/null @@ -1,126 +0,0 @@ -# Boost Software License - Version 1.0 - August 17th, 2003 -# -# Permission is hereby granted, free of charge, to any person or organization -# obtaining a copy of the software and accompanying documentation covered by -# this license (the "Software") to use, reproduce, display, distribute, -# execute, and transmit the Software, and to prepare derivative works of the -# Software, and to permit third-parties to whom the Software is furnished to -# do so, all subject to the following: -# -# The copyright notices in the Software and this entire statement, including -# the above license grant, this restriction and the following disclaimer, -# must be included in all copies of the Software, in whole or in part, and -# all derivative works of the Software, unless such copies or derivative -# works are solely in the form of machine-executable object code generated by -# a source language processor. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -# - Enable Code Coverage -# -# 2012-01-31, Lars Bilke -# -# USAGE: -# 1. Copy this file into your cmake modules path -# 2. Add the following line to your CMakeLists.txt: -# INCLUDE(CodeCoverage) -# -# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target -# which runs your test executable and produces a lcov code coverage report. -# - -# - Changes made by Celix -# 1. Added compiler options using --coverage instead of GCC specific strings -# 2. Added custom target to generate HTML pages for combined coverage results -# 3. Added each coverage target to the overall "coverage" target -# 4. Added "mock" to exclude list for coverage results -# 5. Removed HTML generation from the coverage setup function -# 6. Removed unneeded Cobertura function -# - -# Option to enable/disable coverage -option(ENABLE_CODE_COVERAGE "Enables code coverage" FALSE) - -# Check if coverage is enabled -IF(ENABLE_CODE_COVERAGE) - - # Check prereqs - FIND_PROGRAM( GCOV_PATH gcov ) - FIND_PROGRAM( LCOV_PATH lcov ) - FIND_PROGRAM( GENHTML_PATH genhtml ) - FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) - - IF(NOT GCOV_PATH) - MESSAGE(FATAL_ERROR "gcov not found! Aborting...") - ENDIF() # NOT GCOV_PATH - - #IF(NOT CMAKE_COMPILER_IS_GNUCXX) - # MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") - #ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX - - IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" ) - MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" ) - ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" - - # Setup compiler options - ADD_DEFINITIONS(--coverage) - set(CMAKE_SHARED_LINKER_FLAGS "--coverage") - set(CMAKE_EXE_LINKER_FLAGS "--coverage") - - IF(NOT TARGET coverage) - add_custom_target(coverage - COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results - COMMAND ${GENHTML_PATH} -o coverage_results coverage/*/*.info.cleaned - - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to view the coverage report." - ) - - SET_TARGET_PROPERTIES(coverage PROPERTIES COVERAGE_TARGET_ADDED "") - ENDIF() - -ENDIF(ENABLE_CODE_COVERAGE) - -# Param _targetname The name of new the custom make target -# Param _testrunner The name of the target which runs the tests -# Param _outputname lcov output is generated as _outputname.info -# HTML report is generated in _outputname/index.html -# Optional fourth parameter is passed as arguments to _testrunner -# Pass them in list form, e.g.: "-j;2" for -j 2 -FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) - IF(ENABLE_CODE_COVERAGE) - IF(NOT LCOV_PATH) - MESSAGE(FATAL_ERROR "lcov not found! Aborting...") - ENDIF() # NOT LCOV_PATH - - IF(NOT GENHTML_PATH) - MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") - ENDIF() # NOT GENHTML_PATH - - # Setup target - ADD_CUSTOM_TARGET(${_targetname}_coverage - - # Cleanup lcov - ${LCOV_PATH} --directory . --zerocounters - - # Run tests - COMMAND ${_testrunner} ${ARGV3} - - # Capturing lcov counters and generating report - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage/${_testrunner} - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info - COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'mock/*' 'test/*' '/usr/*' --output-file ${_outputname}.info.cleaned - - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." - ) - ADD_DEPENDENCIES(coverage ${_targetname}_coverage) - ENDIF(ENABLE_CODE_COVERAGE) -ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
