2015-08-20 21:09:14 -04:00
cmake_minimum_required ( VERSION 3.2.2 )
project ( GSLTests )
add_subdirectory ( unittest-cpp )
include_directories (
. . / i n c l u d e
. / u n i t t e s t - c p p
)
add_definitions ( -DSAFER_CPP_TESTING )
if ( MSVC14 OR MSVC12 )
# has the support we need
else ( )
include ( CheckCXXCompilerFlag )
CHECK_CXX_COMPILER_FLAG ( "-std=c++14" COMPILER_SUPPORTS_CXX14 )
CHECK_CXX_COMPILER_FLAG ( "-std=c++11" COMPILER_SUPPORTS_CXX11 )
if ( COMPILER_SUPPORTS_CXX14 )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14" )
elseif ( COMPILER_SUPPORTS_CXX11 )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
else ( )
message ( STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler." )
endif ( )
endif ( )
2015-08-25 14:29:49 -04:00
if ( NOT EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } /unittest-cpp )
2015-08-20 21:09:14 -04:00
message ( FATAL_ERROR "Could not find unittest-cpp enlistment. Please run 'git clone https://github.com/Microsoft/unittest-cpp.git unittest-cpp' in the tests directory" )
endif ( )
add_executable ( array_view_tests
a r r a y _ v i e w _ t e s t s . c p p
)
target_link_libraries ( array_view_tests
U n i t T e s t + +
)
install ( TARGETS array_view_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E a r r a y _ v i e w _ t e s t s
C O M M A N D a r r a y _ v i e w _ t e s t s
)
add_executable ( string_view_tests
s t r i n g _ v i e w _ t e s t s . c p p
)
target_link_libraries ( string_view_tests
U n i t T e s t + +
)
install ( TARGETS string_view_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E s t r i n g _ v i e w _ t e s t s
C O M M A N D s t r i n g _ v i e w _ t e s t s
)
add_executable ( at_tests
a t _ t e s t s . c p p
)
target_link_libraries ( at_tests
U n i t T e s t + +
)
install ( TARGETS at_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E a t _ t e s t s
C O M M A N D a t _ t e s t s
)
add_executable ( bounds_tests
b o u n d s _ t e s t s . c p p
)
target_link_libraries ( bounds_tests
U n i t T e s t + +
)
install ( TARGETS bounds_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E b o u n d s _ t e s t s
C O M M A N D b o u n d s _ t e s t s
)
add_executable ( maybenull_tests
m a y b e n u l l _ t e s t s . c p p
)
target_link_libraries ( maybenull_tests
U n i t T e s t + +
)
install ( TARGETS maybenull_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E m a y b e n u l l _ t e s t s
C O M M A N D m a y b e n u l l _ t e s t s
)
add_executable ( notnull_tests
n o t n u l l _ t e s t s . c p p
)
target_link_libraries ( notnull_tests
U n i t T e s t + +
)
install ( TARGETS notnull_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E n o t n u l l _ t e s t s
C O M M A N D n o t n u l l _ t e s t s
)
add_executable ( assertion_tests
a s s e r t i o n _ t e s t s . c p p
)
target_link_libraries ( assertion_tests
U n i t T e s t + +
)
install ( TARGETS assertion_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E a s s e r t i o n _ t e s t s
C O M M A N D a s s e r t i o n _ t e s t s
)
add_executable ( utils_tests
u t i l s _ t e s t s . c p p
)
target_link_libraries ( utils_tests
U n i t T e s t + +
)
install ( TARGETS utils_tests
R U N T I M E D E S T I N A T I O N b i n
)
add_test (
N A M E u t i l s _ t e s t s
C O M M A N D u t i l s _ t e s t s
)