Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 192 additions & 96 deletions CMakeLists.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ before_build:
- if %platform%==msvc call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
- if %platform%==msvc mkdir build
- if %platform%==msvc chdir build
- if %platform%==msvc cmake --version
- if %platform%==msvc cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%P% -DCMAKE_BUILD_TYPE=Debug ..
- if %platform%==vs (
set "makecommand=Visual Studio"
Expand Down Expand Up @@ -158,13 +159,15 @@ before_build:
)
- if %platform%==vs mkdir build
- if %platform%==vs chdir build
- if %platform%==vs cmake --version
- if %platform%==vs cmake -G "%makecommand%" -DCMAKE_INSTALL_PREFIX=%P% -DCMAKE_BUILD_TYPE=Debug ..
- if %platform%==cygwin set PATH=C:\cygwin\bin;%PATH%
- if %platform%==cygwin bash -c "autoreconf -i"
- if %platform%==cygwin bash -c "./configure"
- if %platform%==mingw32 set PATH=C:\MinGW\bin;%PATH%
- if %platform%==mingw32 mkdir build
- if %platform%==mingw32 chdir build
- if %platform%==mingw32 cmake --version
- if %platform%==mingw32 cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%P% -DCMAKE_BUILD_TYPE=Debug ..
- if %platform%==mingw64msys set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%
- if %platform%==mingw64msys bash -c "autoreconf -i"
Expand Down
39 changes: 37 additions & 2 deletions cmake/check_stdint.h.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
/*-*- mode:C; -*- */
/*
* Check: a unit test framework for C
*
* Copyright (C) 2013 Branden Archer
* Copyright (C) 2019 Mikko Johannes Koivunalho
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/

#ifndef _CHECK_CHECK_STDINT_H
#define _CHECK_CHECK_STDINT_H 1
#ifndef _GENERATED_STDINT_H
#define _GENERATED_STDINT_H "@PROJECT_NAME@ @PROJECT_VERSION@"
/* generated using CMake @CMAKE_VERSION@ from file cmake/check_stdint.h.in */

/* Imported CMake variables created during build. */
#cmakedefine HAVE_STDINT_H 1

#ifdef HAVE_STDINT_H
#define _STDINT_HAVE_STDINT_H 1
#include <stdint.h>
#endif
#endif
#undef HAVE_STDINT_H
#endif /* defined HAVE_STDINT_H */

/* Define only once */
#endif /* _GENERATED_STDINT_H */
#endif /* _CHECK_CHECK_STDINT_H */
3 changes: 3 additions & 0 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the <time.h> header file. */
#cmakedefine HAVE_TIME_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1

/* Define to 1 if the system has the type `unsigned long long'. */
#cmakedefine HAVE_UNSIGNED_LONG_LONG 1

Expand Down
3 changes: 3 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ if(NOT HAVE_DECL_STRSIGNAL)
set(SOURCES ${SOURCES} strsignal.c)
endif(NOT HAVE_DECL_STRSIGNAL)

if(NOT HAVE_DECL_ALARM)
set(SOURCES ${SOURCES} alarm.c)
endif(NOT HAVE_DECL_ALARM)

set(HEADERS libcompat.h)

Expand Down
14 changes: 5 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,15 @@ set(HEADERS
check_print.h
check_str.h)

configure_file(check.h.in check.h)
configure_file(check.h.in check.h @ONLY)

add_library(check STATIC ${SOURCES} ${HEADERS})
target_link_libraries(check ${LIBM} ${LIBRT} ${SUBUNIT})
# Enable finding check.h
if(CMAKE_VERSION VERSION_LESS 2.8.12)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
else()
target_include_directories(check
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>)
endif()
target_include_directories(check
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>)

if(MSVC)
add_definitions(-DCK_DLL_EXP=_declspec\(dllexport\))
Expand Down
4 changes: 4 additions & 0 deletions src/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#include <stdarg.h>
#include <math.h>

#if defined(HAVE_FORK) && HAVE_FORK==1
#include <unistd.h>
#endif /* HAVE_FORK */

#include "check.h"
#include "check_error.h"
#include "check_list.h"
Expand Down
4 changes: 1 addition & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ if(WIN32)
endif(WIN32)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_vars.in
${CMAKE_CURRENT_BINARY_DIR}/test_vars)

include(CTest)
${CMAKE_CURRENT_BINARY_DIR}/test_vars @ONLY)

set(CHECK_CHECK_SOURCES
check_check_exit.c
Expand Down
2 changes: 2 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if [ -d doc/doxygen ]; then
fi

if [ "${USE_CMAKE}" = 'YES' ] ; then
cmake --version
cmake . || exit 1
make || exit 1
ctest -V || exit 1
Expand Down Expand Up @@ -82,6 +83,7 @@ if [ "${PRE_RELEASE_CHECK}" = 'YES' ]; then
make prereleasecheck || exit 1
tar xf check-*.tar.gz
cd check-*
cmake --version
cmake . || exit 1
make || exit 1
fi
Expand Down