Skip to content

Commit 795fc88

Browse files
committed
fail if build type unset and we are in CI
1 parent ba17139 commit 795fc88

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ if (CMAKE_CUDA_ARCHITECTURES MATCHES OFF)
2727
endif()
2828

2929
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
30-
message(NOTICE "Suggesting setting build type expicitly (eg. "
30+
set(MSG
31+
"setting build type expicitly (eg. "
3132
"\"-DCMAKE_BUILD_TYPE=Release\" or \"Debug\") for single-config "
3233
"generators.")
34+
if("$ENV{CI}" STREQUAL "true")
35+
message(FATAL_ERROR "In CI, compulsory ${MSG} You can use \"\" for "
36+
"the default.")
37+
else()
38+
message(NOTICE "Suggesting ${MSG}")
39+
endif()
3340
endif()
3441

3542
cmake_policy(SET CMP0010 NEW) # error on undefined variable

0 commit comments

Comments
 (0)