CMake refactor for easier subdirectory inclusion

This commit is contained in:
Mike Ellery 2019-10-11 17:24:25 -07:00 committed by Howard Hinnant
parent e3186e36c2
commit 48f1455cd2
4 changed files with 234 additions and 121 deletions

View File

@ -1,9 +1,14 @@
language: cpp language: cpp
env:
global:
- CMAKE_EXTRA_CONF="-DCOMPILE_WITH_C_LOCALE=ON"
- CTEST_OUTPUT_ON_FAILURE=1
matrix: matrix:
include: include:
- name: "Ubuntu 16.04 LTS (Xenial Xerus) GCC 7" - name: "Ubuntu 16.04 LTS (Xenial Xerus) GCC 7"
os: linux os: linux
dist: xenial dist: xenial
addons: addons:
@ -15,7 +20,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- name: "Ubuntu 16.04 LTS (Xenial Xerus) GCC 8" - name: "Ubuntu 16.04 LTS (Xenial Xerus) GCC 8"
os: linux os: linux
dist: xenial dist: xenial
addons: addons:
@ -27,7 +32,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
- name: "Ubuntu 16.04 LTS (Xenial Xerus) GCC 9" - name: "Ubuntu 16.04 LTS (Xenial Xerus) GCC 9"
os: linux os: linux
dist: xenial dist: xenial
addons: addons:
@ -39,7 +44,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" - MATRIX_EVAL="CC=gcc-9 && CXX=g++-9"
- name: "Ubuntu 18.04 LTS (Bionic Beaver) GCC 7" - name: "Ubuntu 18.04 LTS (Bionic Beaver) GCC 7"
os: linux os: linux
dist: bionic dist: bionic
addons: addons:
@ -51,7 +56,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- name: "Ubuntu 18.04 LTS (Bionic Beaver) GCC 8" - name: "Ubuntu 18.04 LTS (Bionic Beaver) GCC 8"
os: linux os: linux
dist: bionic dist: bionic
addons: addons:
@ -63,7 +68,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
- name: "Ubuntu 18.04 LTS (Bionic Beaver) Clang 6" - name: "Ubuntu 18.04 LTS (Bionic Beaver) Clang 6"
os: linux os: linux
dist: bionic dist: bionic
addons: addons:
@ -75,7 +80,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0" - MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
- name: "Ubuntu 18.04 LTS (Bionic Beaver) Clang 7" - name: "Ubuntu 18.04 LTS (Bionic Beaver) Clang 7"
os: linux os: linux
dist: bionic dist: bionic
addons: addons:
@ -87,7 +92,7 @@ matrix:
env: env:
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
- name: "Ubuntu 18.04 LTS (Bionic Beaver) Clang 8" - name: "Ubuntu 18.04 LTS (Bionic Beaver) Clang 8"
os: linux os: linux
dist: bionic dist: bionic
addons: addons:
@ -99,13 +104,44 @@ matrix:
env: env:
- MATRIX_EVAL="CC=clang-8 && CXX=clang++-8" - MATRIX_EVAL="CC=clang-8 && CXX=clang++-8"
- &macos
name: xcode10
os: osx
osx_image: xcode10.2
env:
- CMAKE_EXTRA_CONF=""
addons:
homebrew:
packages:
- bash
- ninja
- <<: *macos
name: xcode9
# xcode 9 only works if we tell it to use c++14 explicitly
env:
- CMAKE_EXTRA_CONF="-DCMAKE_CXX_STANDARD=14"
osx_image: xcode9.4
- <<: *macos
osx_image: xcode11
name: xcode11
before_install: before_install:
- eval "${MATRIX_EVAL}" - eval "${MATRIX_EVAL}"
- ci/install_cmake.sh 3.15.2
- export OPENSSL_ROOT=$(brew --prefix openssl@1.1)
- if [ "$(uname)" = "Darwin" ] ; then export PATH="$HOME/cmake/CMake.app/Contents/bin:${PATH}"; fi
- if [ "$(uname)" = "Linux" ] ; then export PATH="$HOME/cmake/bin:${PATH}"; fi
script: cache:
directories:
- $HOME/cmake
script:
- mkdir -p build - mkdir -p build
- cd build - cd build
- cmake -DENABLE_DATE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DCOMPILE_WITH_C_LOCALE=ON .. - eval cmake -DENABLE_DATE_TESTING=ON -DBUILD_SHARED_LIBS=ON ${CMAKE_EXTRA_CONF} ..
- make -j$(nproc) - cmake --build . --parallel
- make testit -j$(nproc) - cmake --build . --parallel --target testit

View File

@ -1,34 +1,52 @@
#[===================================================================[
date library by Howard Hinnant
CMake projects that wish to use this library should consider
something like the following :
include( FetchContent )
FetchContent_Declare( date_src
GIT_REPOSITORY https://github.com/HowardHinnant/date.git
GIT_TAG 2.4.2 # adjust tag/branch/commit as needed
)
FetchContent_MakeAvailable(date_src)
...
target_link_libraries (my_target PRIVATE date::date)
#]===================================================================]
cmake_minimum_required( VERSION 3.1.0 ) cmake_minimum_required( VERSION 3.1.0 )
cmake_policy( VERSION 3.12 ) cmake_policy( VERSION 3.14 )
project( date VERSION 2.4.1 ) project( date VERSION 2.4.1 )
include( GNUInstallDirs ) include( GNUInstallDirs )
find_package( Threads REQUIRED ) get_directory_property( has_parent PARENT_DIRECTORY )
# Override by setting on CMake command line. # Override by setting on CMake command line.
set( CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested.") set( CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested." )
option( USE_SYSTEM_TZ_DB "Use the operating system's timezone database" OFF ) option( USE_SYSTEM_TZ_DB "Use the operating system's timezone database" OFF )
option( USE_TZ_DB_IN_DOT "Save the timezone database in the current folder" OFF ) option( USE_TZ_DB_IN_DOT "Save the timezone database in the current folder" OFF )
option( BUILD_SHARED_LIBS "Build a shared version of library" OFF ) option( BUILD_SHARED_LIBS "Build a shared version of library" OFF )
option( ENABLE_DATE_TESTING "Enable unit tests" ON ) option( ENABLE_DATE_TESTING "Enable unit tests" OFF )
option( DISABLE_STRING_VIEW "Disable string view" OFF ) option( DISABLE_STRING_VIEW "Disable string view" OFF )
option( COMPILE_WITH_C_LOCALE "pass -DONLY_C_LOCALE=1 to compiler") option( COMPILE_WITH_C_LOCALE "define ONLY_C_LOCALE=1" OFF )
option( BUILD_TZ_LIB "build/install of TZ library" OFF )
if(COMPILE_WITH_C_LOCALE) if( ENABLE_DATE_TESTING AND NOT BUILD_TZ_LIB )
#To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388 message(WARNING "Testing requested, bug BUILD_TZ_LIB not ON - forcing the latter")
add_definitions(-DONLY_C_LOCALE=1) set (BUILD_TZ_LIB ON CACHE BOOL "required for testing" FORCE)
endif() endif( )
function( print_option OPT ) function( print_option OPT )
if ( NOT DEFINED PRINT_OPTION_CURR_${OPT} OR ( NOT PRINT_OPTION_CURR_${OPT} STREQUAL ${OPT} ) ) if ( NOT DEFINED PRINT_OPTION_CURR_${OPT} OR ( NOT PRINT_OPTION_CURR_${OPT} STREQUAL ${OPT} ) )
set( PRINT_OPTION_CURR_${OPT} ${${OPT}} CACHE BOOL "" ) set( PRINT_OPTION_CURR_${OPT} ${${OPT}} CACHE BOOL "" )
mark_as_advanced(PRINT_OPTION_CURR_${OPT}) mark_as_advanced(PRINT_OPTION_CURR_${OPT})
message( "# date: ${OPT} ${${OPT}}" ) message( "# date: ${OPT} ${${OPT}}" )
endif( ) endif( )
endfunction( ) endfunction( )
print_option( USE_SYSTEM_TZ_DB ) print_option( USE_SYSTEM_TZ_DB )
@ -37,106 +55,121 @@ print_option( BUILD_SHARED_LIBS )
print_option( ENABLE_DATE_TESTING ) print_option( ENABLE_DATE_TESTING )
print_option( DISABLE_STRING_VIEW ) print_option( DISABLE_STRING_VIEW )
set( HEADER_FOLDER "include" ) #[===================================================================[
set( SOURCE_FOLDER "src" ) date (header only) library
set( TEST_FOLDER "test" ) #]===================================================================]
add_library( date INTERFACE )
# This is needed so IDE's live MSVC show header files add_library( date::date ALIAS date )
set( HEADER_FILES target_include_directories( date INTERFACE
${HEADER_FOLDER}/date/chrono_io.h $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${HEADER_FOLDER}/date/date.h $<INSTALL_INTERFACE:include> )
${HEADER_FOLDER}/date/ios.h # adding header sources just helps IDEs
${HEADER_FOLDER}/date/islamic.h target_sources( date INTERFACE
${HEADER_FOLDER}/date/iso_week.h $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/date.h
${HEADER_FOLDER}/date/julian.h # the rest of these are not currently part of the public interface of the library:
${HEADER_FOLDER}/date/tz.h $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/islamic.h>
${HEADER_FOLDER}/date/tz_private.h $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/iso_week.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/date/julian.h>
) )
# public headers will get installed:
set_target_properties( date PROPERTIES PUBLIC_HEADER include/date/date.h )
target_compile_definitions( date INTERFACE
#To workaround libstdc++ issue https://github.com/HowardHinnant/date/issues/388
ONLY_C_LOCALE=$<IF:$<BOOL:${COMPILE_WITH_C_LOCALE}>,1,0>
$<$<BOOL:${DISABLE_STRING_VIEW}>:HAS_STRING_VIEW=0> )
add_library( tz ${HEADER_FILES} ${SOURCE_FOLDER}/tz.cpp ) #[===================================================================[
tz (compiled) library
if( USE_SYSTEM_TZ_DB ) #]===================================================================]
target_compile_definitions( tz PRIVATE -DUSE_AUTOLOAD=0 ) if( BUILD_TZ_LIB )
target_compile_definitions( tz PRIVATE -DHAS_REMOTE_API=0 ) add_library( tz )
# cannot set USE_OS_TZDB to 1 on Windows target_sources( tz
if( NOT WIN32 ) PUBLIC
target_compile_definitions( tz PUBLIC -DUSE_OS_TZDB=1 ) $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/tz.h
endif( ) $<$<BOOL:${IOS}>:$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>$<INSTALL_INTERFACE:include>/date/ios.h>
else( ) PRIVATE
target_compile_definitions( tz PRIVATE -DUSE_AUTOLOAD=1 ) include/date/tz_private.h
target_compile_definitions( tz PRIVATE -DHAS_REMOTE_API=1 ) $<$<BOOL:${IOS}>:src/ios.mm>
target_compile_definitions( tz PUBLIC -DUSE_OS_TZDB=0 ) src/tz.cpp )
find_package( CURL REQUIRED ) add_library( date::tz ALIAS tz )
include_directories( SYSTEM ${CURL_INCLUDE_DIRS} ) target_link_libraries( tz PUBLIC date )
set( OPTIONAL_LIBRARIES ${CURL_LIBRARIES} ) target_include_directories( tz PUBLIC
endif( ) $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> )
if( USE_TZ_DB_IN_DOT ) target_compile_definitions( tz
target_compile_definitions( tz PRIVATE -DINSTALL=. ) PRIVATE
endif( ) USE_AUTOLOAD=$<IF:$<BOOL:${USE_SYSTEM_TZ_DB}>,0,1>
HAS_REMOTE_API=$<IF:$<BOOL:${USE_SYSTEM_TZ_DB}>,0,1>
if( DISABLE_STRING_VIEW ) $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_BUILD_DLL=1>
target_compile_definitions( tz PRIVATE -DHAS_STRING_VIEW=0 ) $<$<BOOL:${USE_TZ_DB_IN_DOT}>:INSTALL=.>
endif( ) PUBLIC
USE_OS_TZDB=$<IF:$<AND:$<BOOL:${USE_SYSTEM_TZ_DB}>,$<NOT:$<BOOL:${WIN32}>>>,1,0>
if( BUILD_SHARED_LIBS ) INTERFACE
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC") $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${BUILD_SHARED_LIBS}>>:DATE_USE_DLL=1> )
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC") set(TZ_HEADERS include/date/tz.h)
if( WIN32 ) if( IOS )
target_compile_definitions( tz PRIVATE -DDATE_BUILD_DLL=1 PUBLIC -DDATE_USE_DLL=1 ) list(APPEND TZ_HEADERS include/date/ios.h)
endif( )
set_target_properties( tz PROPERTIES
POSITION_INDEPENDENT_CODE ON
PUBLIC_HEADER "${TZ_HEADERS}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION}" )
if( NOT MSVC )
find_package( Threads )
target_link_libraries( tz PUBLIC Threads::Threads )
endif( )
if( NOT USE_SYSTEM_TZ_DB )
find_package( CURL REQUIRED )
target_link_libraries( tz PRIVATE CURL::libcurl )
endif( ) endif( )
endif( ) endif( )
target_link_libraries( tz ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_LIBRARIES} ) #[===================================================================[
installation
#]===================================================================]
set( version_config "${CMAKE_CURRENT_BINARY_DIR}/dateConfigVersion.cmake" )
# add include folders to the library and targets that consume it include( CMakePackageConfigHelpers )
target_include_directories(tz PUBLIC write_basic_package_version_file( "${version_config}"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_FOLDER}> VERSION ${PROJECT_VERSION}
$<INSTALL_INTERFACE:include> COMPATIBILITY SameMajorVersion )
)
set(version_config "${CMAKE_CURRENT_BINARY_DIR}/dateConfigVersion.cmake")
set_target_properties(tz PROPERTIES VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION}")
include(CMakePackageConfigHelpers) install( TARGETS date
write_basic_package_version_file("${version_config}" VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion) EXPORT dateConfig
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date )
# An interface library (not a compiled library), to enable automatic include_directory (for when just date.h, export( TARGETS date NAMESPACE date:: FILE dateConfig.cmake )
# but not "tz.h and its lib" are needed)
add_library(date INTERFACE)
# add include folders to the INTERFACE and targets that consume it if( BUILD_TZ_LIB )
target_include_directories(date INTERFACE install( TARGETS tz
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> EXPORT dateConfig
$<INSTALL_INTERFACE:include> PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/date
) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) # This is for Windows
export( TARGETS tz NAMESPACE date:: APPEND FILE dateConfig.cmake )
endif( )
if(WIN32 AND NOT CYGWIN) if( WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR CMake) set( CONFIG_LOC CMake )
else() else( )
set(DEF_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/date) set( CONFIG_LOC "${CMAKE_INSTALL_LIBDIR}/cmake/date" )
endif() endif( )
install( EXPORT dateConfig
install( TARGETS tz EXPORT dateConfig NAMESPACE date::
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} DESTINATION ${CONFIG_LOC} )
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # This is for Windows
export(TARGETS date tz NAMESPACE date:: FILE dateConfig.cmake)
install(TARGETS date EXPORT dateConfig)
install(EXPORT dateConfig NAMESPACE date:: DESTINATION ${DEF_INSTALL_CMAKE_DIR})
install(DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/)
if ( ENABLE_DATE_TESTING )
#[===================================================================[
testing
#]===================================================================]
if( ENABLE_DATE_TESTING )
enable_testing( ) enable_testing( )
add_custom_target( testit COMMAND ${CMAKE_CTEST_COMMAND} ) add_custom_target( testit COMMAND ${CMAKE_CTEST_COMMAND} )
add_dependencies( testit tz ) add_dependencies( testit tz )
function( add_pass_tests TEST_GLOB TEST_PREFIX ) function( add_pass_tests TEST_GLOB TEST_PREFIX )
file( GLOB_RECURSE FILENAMES ${TEST_GLOB} ) file( GLOB_RECURSE FILENAMES ${TEST_GLOB} )
include_directories( "${HEADER_FOLDER}/date" )
foreach( TEST_FILE ${FILENAMES} ) foreach( TEST_FILE ${FILENAMES} )
get_filename_component( TEST_NAME ${TEST_FILE} NAME_WE ) get_filename_component( TEST_NAME ${TEST_FILE} NAME_WE )
@ -148,6 +181,8 @@ if ( ENABLE_DATE_TESTING )
add_executable( ${BIN_NAME} EXCLUDE_FROM_ALL ${TEST_FILE} ) add_executable( ${BIN_NAME} EXCLUDE_FROM_ALL ${TEST_FILE} )
add_test( ${TST_NAME} ${BIN_NAME} ) add_test( ${TST_NAME} ${BIN_NAME} )
target_link_libraries( ${BIN_NAME} tz ) target_link_libraries( ${BIN_NAME} tz )
# HACK: because the test files don't use FQ includes:
target_include_directories( ${BIN_NAME} PRIVATE include/date )
add_dependencies( testit ${BIN_NAME} ) add_dependencies( testit ${BIN_NAME} )
endif( ) endif( )
endforeach( ) endforeach( )
@ -160,29 +195,37 @@ if ( ENABLE_DATE_TESTING )
get_filename_component( TEST_NAME ${TEST_FILE} NAME_WE ) get_filename_component( TEST_NAME ${TEST_FILE} NAME_WE )
get_filename_component( TEST_EXT ${TEST_FILE} EXT ) get_filename_component( TEST_EXT ${TEST_FILE} EXT )
set( TEST_TYPE "_fail" ) set( TEST_TYPE "_fail" )
set( PREFIX "${TEST_PREFIX}_fail_${TEST_NAME}" ) set( PREFIX "${TEST_PREFIX}_fail_${TEST_NAME}" )
set( BIN_NAME ${PREFIX}_bin ) set( BIN_NAME ${PREFIX}_bin )
set( TST_NAME ${PREFIX}_test ) set( TST_NAME ${PREFIX}_test )
#target_compile_definitions( ${BIN_NAME} PRIVATE ${TST_NAME} )
set( TEST_BIN_NAME ${CMAKE_BINARY_DIR}/${BIN_NAME} ) set( TEST_BIN_NAME ${CMAKE_BINARY_DIR}/${BIN_NAME} )
add_custom_target( ${BIN_NAME} add_custom_target( ${BIN_NAME}
COMMAND ${PROJECT_SOURCE_DIR}/compile_fail.sh ${TEST_BIN_NAME} ${CMAKE_CXX_COMPILER} -std=c++14 -L${CMAKE_BINARY_DIR}/ -ltz -I${PROJECT_SOURCE_DIR}/${HEADER_FOLDER}/date -o ${BIN_NAME} ${TEST_FILE} COMMAND
${PROJECT_SOURCE_DIR}/compile_fail.sh
${TEST_BIN_NAME}
${CMAKE_CXX_COMPILER}
-std=c++14
-L${CMAKE_BINARY_DIR}/
-ltz
-I${PROJECT_SOURCE_DIR}/include
-I${PROJECT_SOURCE_DIR}/include/date
-o ${BIN_NAME}
${TEST_FILE}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT ${TST_NAME} COMMENT ${TST_NAME} )
)
add_test( ${TST_NAME} "${PROJECT_SOURCE_DIR}/test_fail.sh" ${CMAKE_BINARY_DIR}/${BIN_NAME} WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/" ) add_test( ${TST_NAME} "${PROJECT_SOURCE_DIR}/test_fail.sh" ${CMAKE_BINARY_DIR}/${BIN_NAME} WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/" )
#set_tests_properties( ${TST_NAME} PROPERTIES WILL_FAIL TRUE) #set_tests_properties( ${TST_NAME} PROPERTIES WILL_FAIL TRUE)
add_dependencies( testit ${BIN_NAME} ) add_dependencies( testit ${BIN_NAME} )
endforeach( ) endforeach( )
endfunction( ) endfunction( )
file( GLOB children RELATIVE "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}" "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/*" ) file( GLOB children RELATIVE "${PROJECT_SOURCE_DIR}/test" "${PROJECT_SOURCE_DIR}/test/*" )
foreach( child ${children} ) foreach( child ${children} )
if( IS_DIRECTORY "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/${child}" ) if( IS_DIRECTORY "${PROJECT_SOURCE_DIR}/test/${child}" )
set( CUR_FOLDER "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/${child}" ) set( CUR_FOLDER "${PROJECT_SOURCE_DIR}/test/${child}" )
add_pass_tests( "${CUR_FOLDER}/*.cpp" ${child} ) add_pass_tests( "${CUR_FOLDER}/*.cpp" ${child} )
if( NOT WIN32 ) if( NOT WIN32 )
add_fail_tests( "${CUR_FOLDER}/*.fail.cpp" ${child} ) add_fail_tests( "${CUR_FOLDER}/*.fail.cpp" ${child} )

34
ci/install_cmake.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -e
IFS=. read cm_maj cm_min cm_rel <<<"$1"
: ${cm_rel:-0}
CMAKE_ROOT=${2:-"${HOME}/cmake"}
function cmake_version ()
{
if [[ -d ${CMAKE_ROOT} ]] ; then
local perms=$(test $(uname) = "Linux" && echo "/111" || echo "+111")
local installed=$(find ${CMAKE_ROOT} -perm ${perms} -type f -name cmake)
if [[ "${installed}" != "" ]] ; then
echo "$(${installed} --version | head -1)"
fi
fi
}
installed=$(cmake_version)
if [[ "${installed}" != "" && ${installed} =~ ${cm_maj}.${cm_min}.${cm_rel} ]] ; then
echo "cmake already installed: ${installed}"
exit
fi
pkgname="cmake-${cm_maj}.${cm_min}.${cm_rel}-$(uname)-x86_64.tar.gz"
tmppkg="/tmp/cmake.tar.gz"
wget --quiet https://cmake.org/files/v${cm_maj}.${cm_min}/${pkgname} -O ${tmppkg}
mkdir -p ${CMAKE_ROOT}
cd ${CMAKE_ROOT}
tar --strip-components 1 -xf ${tmppkg}
rm -f ${tmppkg}
echo "installed: $(cmake_version)"

View File

@ -22,7 +22,7 @@
// SOFTWARE. // SOFTWARE.
// //
#include "ios.h" #include "date/ios.h"
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE