|
Packit |
0b5880 |
# Copyright (c) 2017, Branden Archer
|
|
Packit |
0b5880 |
# All rights reserved.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
0b5880 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
0b5880 |
# * Redistributions of source code must retain the above copyright
|
|
Packit |
0b5880 |
# notice, this list of conditions and the following disclaimer.
|
|
Packit |
0b5880 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
0b5880 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit |
0b5880 |
# documentation and/or other materials provided with the distribution.
|
|
Packit |
0b5880 |
# * Neither the name of this project nor the names of its contributors may
|
|
Packit |
0b5880 |
# be used to endorse or promote products derived from this software without
|
|
Packit |
0b5880 |
# specific prior written permission.
|
|
Packit |
0b5880 |
#
|
|
Packit |
0b5880 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
Packit |
0b5880 |
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
Packit |
0b5880 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
0b5880 |
# DISCLAIMED. IN NO EVENT SHALL Branden Archer BE LIABLE FOR ANY
|
|
Packit |
0b5880 |
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
Packit |
0b5880 |
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
Packit |
0b5880 |
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
Packit |
0b5880 |
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
0b5880 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
Packit |
0b5880 |
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
project(money C)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
|
Packit |
0b5880 |
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Set build features
|
|
Packit |
0b5880 |
set(CMAKE_BUILD_TYPE Debug)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
include(CheckCSourceCompiles)
|
|
Packit |
0b5880 |
include(CheckCSourceRuns)
|
|
Packit |
0b5880 |
include(CheckFunctionExists)
|
|
Packit |
0b5880 |
include(CheckIncludeFile)
|
|
Packit |
0b5880 |
include(CheckIncludeFiles)
|
|
Packit |
0b5880 |
include(CheckLibraryExists)
|
|
Packit |
0b5880 |
include(CheckSymbolExists)
|
|
Packit |
0b5880 |
include(CheckTypeSize)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Check headers
|
|
Packit |
0b5880 |
set(INCLUDES "")
|
|
Packit |
0b5880 |
macro(ck_check_include_file header var)
|
|
Packit |
0b5880 |
check_include_files("${INCLUDES};${header}" ${var})
|
|
Packit |
0b5880 |
if(${var})
|
|
Packit |
0b5880 |
set(INCLUDES ${INCLUDES} ${header})
|
|
Packit |
0b5880 |
endif(${var})
|
|
Packit |
0b5880 |
endmacro(ck_check_include_file)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
ck_check_include_file("stdlib.h" HAVE_STDLIB_H)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Check functions
|
|
Packit |
0b5880 |
# (Nothing to check for the money example)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Check defines
|
|
Packit |
0b5880 |
# (Nothing to check for the money example)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Check struct members
|
|
Packit |
0b5880 |
# (Nothing to check for the money example)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Check for integer types
|
|
Packit |
0b5880 |
# (The following are used in check.h. Regardless if they are used in
|
|
Packit |
0b5880 |
# the project, they will need to be checked in order to use Check).
|
|
Packit |
0b5880 |
check_type_size(intmax_t INTMAX_T)
|
|
Packit |
0b5880 |
check_type_size(uintmax_t UINTMAX_T)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
check_type_size(pid_t PID_T)
|
|
Packit |
0b5880 |
if(NOT HAVE_PID_T)
|
|
Packit |
0b5880 |
if(WIN32)
|
|
Packit |
0b5880 |
set(pid_t "int")
|
|
Packit |
0b5880 |
else(WIN32)
|
|
Packit |
0b5880 |
MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?")
|
|
Packit |
0b5880 |
endif(WIN32)
|
|
Packit |
0b5880 |
endif(NOT HAVE_PID_T)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Check libraries
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Generate "config.h" from "cmake/config.h.cmake"
|
|
Packit |
0b5880 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in
|
|
Packit |
0b5880 |
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
Packit |
0b5880 |
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
|
Packit |
0b5880 |
add_definitions(-DHAVE_CONFIG_H)
|
|
Packit |
0b5880 |
set(CONFIG_HEADER ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Subdirectories
|
|
Packit |
0b5880 |
add_subdirectory(src)
|
|
Packit |
0b5880 |
add_subdirectory(tests)
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
###############################################################################
|
|
Packit |
0b5880 |
# Unit tests
|
|
Packit |
0b5880 |
enable_testing()
|
|
Packit |
0b5880 |
add_test(NAME check_money COMMAND check_money)
|
|
Packit |
0b5880 |
|