diff --git a/CMakeLists.txt b/CMakeLists.txt index f297669bf81b10321a7ba0b24dfc680bfe439856..de328380512fdc8a55b00b38d20a6b00504839ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,63 +1,59 @@ # -# Copyright (c) 2014, 2020 CNRS -# Authors: Joseph Mirabel, Guilhem Saurel +# Copyright (c) 2014, 2020 CNRS Authors: Joseph Mirabel, Guilhem Saurel # +# This file is part of hpp-statistics hpp-statistics is free software: you can +# redistribute it and/or modify it under the terms of the GNU Lesser General +# Public License as published by the Free Software Foundation, either version 3 +# of the License, or (at your option) any later version. # -# This file is part of hpp-statistics -# hpp-statistics is free software: you can redistribute it -# and/or modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation, either version -# 3 of the License, or (at your option) any later version. -# -# hpp-statistics 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 Lesser Public License for more details. You should have -# received a copy of the GNU Lesser General Public License along with -# hpp-statistics If not, see -# <http://www.gnu.org/licenses/>. +# hpp-statistics 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 Lesser Public License for more +# details. You should have received a copy of the GNU Lesser General Public +# License along with hpp-statistics If not, see <http://www.gnu.org/licenses/>. -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) +cmake_minimum_required(VERSION 3.1) -SET(PROJECT_NAME hpp-statistics) -SET(PROJECT_DESCRIPTION "Classes for doing statistics.") +set(PROJECT_NAME hpp-statistics) +set(PROJECT_DESCRIPTION "Classes for doing statistics.") -SET(PROJECT_USE_CMAKE_EXPORT TRUE) +set(PROJECT_USE_CMAKE_EXPORT TRUE) -INCLUDE(cmake/hpp.cmake) +include(cmake/hpp.cmake) -COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX) -PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) +compute_project_args(PROJECT_ARGS LANGUAGES CXX) +project(${PROJECT_NAME} ${PROJECT_ARGS}) # Activate hpp-util logging if requested -SET (HPP_DEBUG FALSE CACHE BOOL "trigger hpp-util debug output") -IF (HPP_DEBUG) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHPP_DEBUG") -ENDIF() +set(HPP_DEBUG + FALSE + CACHE BOOL "trigger hpp-util debug output") +if(HPP_DEBUG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHPP_DEBUG") +endif() -ADD_PROJECT_DEPENDENCY(hpp-util REQUIRED) +add_project_dependency(hpp-util REQUIRED) -SET(${PROJECT_NAME}_HEADERS - include/hpp/statistics/fwd.hh - include/hpp/statistics/bin.hh - include/hpp/statistics/success-bin.hh - include/hpp/statistics/distribution.hh - ) +set(${PROJECT_NAME}_HEADERS + include/hpp/statistics/fwd.hh include/hpp/statistics/bin.hh + include/hpp/statistics/success-bin.hh + include/hpp/statistics/distribution.hh) -SET(${PROJECT_NAME}_SOURCES - src/success-bin.cc - ) +set(${PROJECT_NAME}_SOURCES src/success-bin.cc) -ADD_LIBRARY(${PROJECT_NAME} SHARED - ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS}) -TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} hpp-util::hpp-util) +add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} + ${${PROJECT_NAME}_HEADERS}) +target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>) +target_link_libraries(${PROJECT_NAME} hpp-util::hpp-util) -INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib) +install( + TARGETS ${PROJECT_NAME} + EXPORT ${TARGETS_EXPORT_NAME} + DESTINATION lib) -ADD_SUBDIRECTORY(tests) +add_subdirectory(tests) # Add dependency toward hpp-statistics library in pkg-config file. -PKG_CONFIG_APPEND_LIBS("hpp-statistics") +pkg_config_append_libs("hpp-statistics") -INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME}) +install(FILES package.xml DESTINATION share/${PROJECT_NAME}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 93ca6cc4198b47e7679cb98eda335b6236e10e44..291eb466954619a246e92ae5d4db2bc826af65d5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,32 +2,30 @@ # # Author: Mathieu Geisert # -# This file is part of hpp-core -# hpp-model-urdf is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This file is part of hpp-core hpp-model-urdf is free software: you can +# redistribute it and/or modify it under the terms of the GNU Lesser General +# Public License as published by the Free Software Foundation, either version 3 +# of the License, or (at your option) any later version. # -# hpp-core 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 Lesser Public License for more details. -# You should have received a copy of the GNU Lesser General Public License -# along with hpp-core If not, see <http://www.gnu.org/licenses/>. +# hpp-core 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 Lesser Public License for more +# details. You should have received a copy of the GNU Lesser General Public +# License along with hpp-core If not, see <http://www.gnu.org/licenses/>. # ADD_TESTCASE(NAME) # ------------------------ # # Define a test named `NAME'. # -# This macro will create a binary from `NAME.cc', link it against -# Boost and add it to the test suite. +# This macro will create a binary from `NAME.cc', link it against Boost and add +# it to the test suite. # -MACRO(ADD_TESTCASE NAME) - ADD_UNIT_TEST(${NAME} ${NAME}.cc) - TARGET_LINK_LIBRARIES(${NAME} ${PROJECT_NAME}) -ENDMACRO(ADD_TESTCASE) +macro(ADD_TESTCASE NAME) + add_unit_test(${NAME} ${NAME}.cc) + target_link_libraries(${NAME} ${PROJECT_NAME}) +endmacro(ADD_TESTCASE) -ADD_TESTCASE(test-successstatistics) -ADD_TESTCASE(test-distribution) -ADD_TESTCASE(test-statistics) +add_testcase(test-successstatistics) +add_testcase(test-distribution) +add_testcase(test-statistics)