8000 Merge pull request #115 from unittest-cpp/add_cmake_option_to_disable… · unittest-cpp/unittest-cpp@83dbcc0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83dbcc0

Browse files
authored
Merge pull request #115 from unittest-cpp/add_cmake_option_to_disable_running_tests_as_build_step
Add UTPP_INCLUDE_TESTS_IN_BUILD CMake option
2 parents 097c71e + 6b69ed7 commit 83dbcc0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
cmake_minimum_required(VERSION 2.8.1)
22
project(UnitTest++)
33

4-
option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" ON)
4+
option(UTPP_USE_PLUS_SIGN
5+
"Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths"
6+
ON)
7+
option(UTPP_INCLUDE_TESTS_IN_BUILD
8+
"Set this to OFF if you do not wish to automatically build or run unit tests as part of the default cmake --build"
9+
ON)
510

611
if(MSVC14 OR MSVC12)
712
# has the support we need
@@ -57,8 +62,12 @@ target_link_libraries(TestUnitTest++ UnitTest++)
5762

5863
# run unit tests as post build step
5964
add_custom_command(TARGET TestUnitTest++
60-
POST_BUILD COMMAND TestUnitTest++
61-
COMMENT "Running unit tests")
65+
POST_BUILD COMMAND TestUnitTest++
66+
COMMENT "Running unit tests")
67+
68+
if(NOT ${UTPP_INCLUDE_TESTS_IN_BUILD})
69+
set_target_properties(TestUnitTest++ PROPERTIES EXCLUDE_FROM_ALL 1)
70+
endif()
6271

6372
# add install targets
6473
# need a custom install path?

0 commit comments

Comments
 (0)
0