put cmake_modules files back, we can support two build systems
This commit is contained in:
parent
9eab3619c1
commit
25e3644630
5 changed files with 196 additions and 0 deletions
54
cmake_modules/FindCheck.cmake
Normal file
54
cmake_modules/FindCheck.cmake
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# - Try to find the CHECK libraries
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# CHECK_FOUND - system has check
|
||||||
|
# CHECK_INCLUDE_DIRS - the check include directory
|
||||||
|
# CHECK_LIBRARIES - check library
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007 Daniel Gollub <gollub@b1-systems.de>
|
||||||
|
# Copyright (c) 2007-2009 Bjoern Ricks <bjoern.ricks@gmail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE( FindPkgConfig )
|
||||||
|
|
||||||
|
IF ( Check_FIND_REQUIRED )
|
||||||
|
SET( _pkgconfig_REQUIRED "REQUIRED" )
|
||||||
|
ELSE( Check_FIND_REQUIRED )
|
||||||
|
SET( _pkgconfig_REQUIRED "" )
|
||||||
|
ENDIF ( Check_FIND_REQUIRED )
|
||||||
|
|
||||||
|
IF ( CHECK_MIN_VERSION )
|
||||||
|
PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check>=${CHECK_MIN_VERSION} )
|
||||||
|
ELSE ( CHECK_MIN_VERSION )
|
||||||
|
PKG_SEARCH_MODULE( CHECK ${_pkgconfig_REQUIRED} check )
|
||||||
|
ENDIF ( CHECK_MIN_VERSION )
|
||||||
|
|
||||||
|
# Look for CHECK include dir and libraries
|
||||||
|
IF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||||
|
|
||||||
|
FIND_PATH( CHECK_INCLUDE_DIRS check.h )
|
||||||
|
|
||||||
|
FIND_LIBRARY( CHECK_LIBRARIES NAMES check )
|
||||||
|
|
||||||
|
IF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
|
||||||
|
SET( CHECK_FOUND 1 )
|
||||||
|
IF ( NOT Check_FIND_QUIETLY )
|
||||||
|
MESSAGE ( STATUS "Found CHECK: ${CHECK_LIBRARIES}" )
|
||||||
|
ENDIF ( NOT Check_FIND_QUIETLY )
|
||||||
|
ELSE ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
|
||||||
|
IF ( Check_FIND_REQUIRED )
|
||||||
|
MESSAGE( FATAL_ERROR "Could NOT find CHECK" )
|
||||||
|
ELSE ( Check_FIND_REQUIRED )
|
||||||
|
IF ( NOT Check_FIND_QUIETLY )
|
||||||
|
MESSAGE( STATUS "Could NOT find CHECK" )
|
||||||
|
ENDIF ( NOT Check_FIND_QUIETLY )
|
||||||
|
ENDIF ( Check_FIND_REQUIRED )
|
||||||
|
ENDIF ( CHECK_INCLUDE_DIRS AND CHECK_LIBRARIES )
|
||||||
|
ENDIF( NOT CHECK_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||||
|
|
||||||
|
# Hide advanced variables from CMake GUIs
|
||||||
|
MARK_AS_ADVANCED( CHECK_INCLUDE_DIRS CHECK_LIBRARIES )
|
44
cmake_modules/FindJemalloc.cmake
Normal file
44
cmake_modules/FindJemalloc.cmake
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
# - Try to find jemalloc headers and libraries.
|
||||||
|
#
|
||||||
|
# Usage of this module as follows:
|
||||||
|
#
|
||||||
|
# find_package(JeMalloc)
|
||||||
|
#
|
||||||
|
# Variables used by this module, they can change the default behaviour and need
|
||||||
|
# to be set before calling find_package:
|
||||||
|
#
|
||||||
|
# JEMALLOC_ROOT_DIR Set this variable to the root installation of
|
||||||
|
# jemalloc if the module has problems finding
|
||||||
|
# the proper installation path.
|
||||||
|
#
|
||||||
|
# Variables defined by this module:
|
||||||
|
#
|
||||||
|
# JEMALLOC_FOUND System has jemalloc libs/headers
|
||||||
|
# JEMALLOC_LIBRARIES The jemalloc library/libraries
|
||||||
|
# JEMALLOC_INCLUDE_DIR The location of jemalloc headers
|
||||||
|
|
||||||
|
find_path(JEMALLOC_ROOT_DIR
|
||||||
|
NAMES include/jemalloc/jemalloc.h
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(JEMALLOC_LIBRARIES
|
||||||
|
NAMES jemalloc
|
||||||
|
HINTS ${JEMALLOC_ROOT_DIR}/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(JEMALLOC_INCLUDE_DIR
|
||||||
|
NAMES jemalloc/jemalloc.h
|
||||||
|
HINTS ${JEMALLOC_ROOT_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
|
||||||
|
JEMALLOC_LIBRARIES
|
||||||
|
JEMALLOC_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
JEMALLOC_ROOT_DIR
|
||||||
|
JEMALLOC_LIBRARIES
|
||||||
|
JEMALLOC_INCLUDE_DIR
|
||||||
|
)
|
37
cmake_modules/FindJudy.cmake
Normal file
37
cmake_modules/FindJudy.cmake
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Copyright (C) 2007-2009 LuaDist.
|
||||||
|
# Created by Peter Kapec <kapecp@gmail.com>
|
||||||
|
# Redistribution and use of this file is allowed according to the terms of the MIT license.
|
||||||
|
# For details see the COPYRIGHT file distributed with LuaDist.
|
||||||
|
# Note:
|
||||||
|
# Searching headers and libraries is very simple and is NOT as powerful as scripts
|
||||||
|
# distributed with CMake, because LuaDist defines directories to search for.
|
||||||
|
# Everyone is encouraged to contact the author with improvements. Maybe this file
|
||||||
|
# becomes part of CMake distribution sometimes.
|
||||||
|
|
||||||
|
# - Find judy
|
||||||
|
# Find the native Judy headers and libraries.
|
||||||
|
#
|
||||||
|
# Judy_INCLUDE_DIRS - where to find judy.h, etc.
|
||||||
|
# Judy_LIBRARIES - List of libraries when using judy.
|
||||||
|
# Judy_FOUND - True if judy found.
|
||||||
|
|
||||||
|
# Look for the header file.
|
||||||
|
FIND_PATH(Judy_INCLUDE_DIR NAMES Judy.h)
|
||||||
|
|
||||||
|
# Look for the library.
|
||||||
|
FIND_LIBRARY(Judy_LIBRARY NAMES judy)
|
||||||
|
|
||||||
|
# Handle the QUIETLY and REQUIRED arguments and set Judy_FOUND to TRUE if all listed variables are TRUE.
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Judy DEFAULT_MSG Judy_LIBRARY Judy_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables.
|
||||||
|
IF(Judy_FOUND)
|
||||||
|
SET(Judy_LIBRARIES ${Judy_LIBRARY})
|
||||||
|
SET(Judy_INCLUDE_DIRS ${Judy_INCLUDE_DIR})
|
||||||
|
ELSE(Judy_FOUND)
|
||||||
|
SET(Judy_LIBRARIES)
|
||||||
|
SET(Judy_INCLUDE_DIRS)
|
||||||
|
ENDIF(Judy_FOUND)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(Judy_INCLUDE_DIRS Judy_LIBRARIES)
|
37
cmake_modules/FindPCRE.cmake
Normal file
37
cmake_modules/FindPCRE.cmake
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Copyright (C) 2007-2009 LuaDist.
|
||||||
|
# Created by Peter Kapec <kapecp@gmail.com>
|
||||||
|
# Redistribution and use of this file is allowed according to the terms of the MIT license.
|
||||||
|
# For details see the COPYRIGHT file distributed with LuaDist.
|
||||||
|
# Note:
|
||||||
|
# Searching headers and libraries is very simple and is NOT as powerful as scripts
|
||||||
|
# distributed with CMake, because LuaDist defines directories to search for.
|
||||||
|
# Everyone is encouraged to contact the author with improvements. Maybe this file
|
||||||
|
# becomes part of CMake distribution sometimes.
|
||||||
|
|
||||||
|
# - Find pcre
|
||||||
|
# Find the native PCRE headers and libraries.
|
||||||
|
#
|
||||||
|
# PCRE_INCLUDE_DIRS - where to find pcre.h, etc.
|
||||||
|
# PCRE_LIBRARIES - List of libraries when using pcre.
|
||||||
|
# PCRE_FOUND - True if pcre found.
|
||||||
|
|
||||||
|
# Look for the header file.
|
||||||
|
FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h)
|
||||||
|
|
||||||
|
# Look for the library.
|
||||||
|
FIND_LIBRARY(PCRE_LIBRARY NAMES pcre)
|
||||||
|
|
||||||
|
# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables.
|
||||||
|
IF(PCRE_FOUND)
|
||||||
|
SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
|
||||||
|
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
|
||||||
|
ELSE(PCRE_FOUND)
|
||||||
|
SET(PCRE_LIBRARIES)
|
||||||
|
SET(PCRE_INCLUDE_DIRS)
|
||||||
|
ENDIF(PCRE_FOUND)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES)
|
24
tests/CMakeLists.txt
Normal file
24
tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# set(TEST_LIBS ${TEST_LIBS} ${CHECK_LIBRARIES} judy libr3)
|
||||||
|
# set(TEST_LIBS ${TEST_LIBS} ${CHECK_LIBRARIES} judy libr3)
|
||||||
|
find_package(Check REQUIRED)
|
||||||
|
find_package(PCRE REQUIRED)
|
||||||
|
# find_package(Judy REQUIRED)
|
||||||
|
|
||||||
|
if (NOT CHECK_FOUND)
|
||||||
|
message(STATUS "Skipping unit tests, Check library not found!")
|
||||||
|
else (NOT CHECK_FOUND)
|
||||||
|
set(TEST_LIBS ${LIBS} ${CHECK_LIBRARIES} ${PCRE_LIBRARIES} r3)
|
||||||
|
|
||||||
|
include_directories(${CHECK_INCLUDE_DIRS})
|
||||||
|
# include_directories("${PROJECT_SOURCE_DIR}/include/r2")
|
||||||
|
add_executable(test_r3 test_tree.c)
|
||||||
|
target_link_libraries(test_r3 ${TEST_LIBS})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
TARGET test_r3 POST_BUILD
|
||||||
|
COMMENT "Running unit tests"
|
||||||
|
COMMAND test_r3
|
||||||
|
)
|
||||||
|
endif (NOT CHECK_FOUND)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue