File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ add_executable(clock_example example/main-clock.cpp)
2525add_executable (count_fives_example example/main-count-fives.cpp )
2626
2727# Building time tests (/compile-test)
28- # These invoke "cmake --build ..."
2928# Tests that should compile
3029FILE (GLOB TestCompileSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test -compile/compiles/*_test.cpp )
3130foreach (testCompSrc ${TestCompileSources} )
@@ -40,3 +39,16 @@ foreach(testCompSrc ${TestCompileSources})
4039 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
4140endforeach (testCompSrc )
4241
42+ # Tests that should fail compilation
43+ FILE (GLOB TestCompileFailSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test -compile/compile-fails/*_test.cpp )
44+ foreach (testCmpFailSrc ${TestCompileFailSources} )
45+ get_filename_component (testCmpFailName ${testCmpFailSrc} NAME_WE )
46+ add_executable (${testCmpFailName} ${testCmpFailSrc} )
47+ set_target_properties (${testCmpFailName} PROPERTIES
48+ EXCLUDE_FROM_ALL TRUE
49+ EXCLUDE_FROM_DEFAULT_BUILD TRUE )
50+ add_test (NAME ${testCmpFailName}
51+ COMMAND ${CMAKE_COMMAND} --build . --target ${testCmpFailName}
52+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
53+ set_tests_properties (${testCmpFailName} PROPERTIES WILL_FAIL TRUE )
54+ endforeach (testCmpFailSrc )
You can’t perform that action at this time.
0 commit comments