Skip to content

Commit 2befe35

Browse files
committed
CMake: warn if the user did not set a build type
I did not get a warning for `-GNinja`, and the resulting failure is bizarre: ``` $ ninja Halide_Python [10/1842] Generating .__init__.py.stamp FAILED: python_bindings/src/halide/.__init__.py.stamp /repositories/halide/build-halide/python_bindings/src/halide/.__init__.py.stamp cd /repositories/halide/build-halide/python_bindings/src/halide && /usr/bin/cmake -E copy /repositories/halide/python_bindings/src/halide/__init__.py /halide/__init__.py1111 && /usr/bin/cmake -E touch /repositories/halide/build-halide/python_bindings/src/halide/.__init__.py.stamp Error copying file "/repositories/halide/python_bindings/src/halide/__init__.py" to "/halide/__init__.py". [43/1842] Building CXX object _deps/flatbuffers-build/CMakeFiles/flatbuffers.dir/src/idl_parser.cpp.o ninja: build stopped: subcommand failed. ``` (`TARGET_FILE_DIR` is somehow missing `CMAKE_CURRENT_BINARY_DIR` prefix)
1 parent 8864e8a commit 2befe35

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

CMakeLists.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ include(HalideGeneratorHelpers)
2121
# Build Halide as a shared lib by default, but still honor command-line settings.
2222
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
2323

24-
# Warn if the user did not set a build type and is using a single-configuration generator.
25-
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
26-
if (NOT IS_MULTI_CONFIG AND NOT DEFINED CMAKE_BUILD_TYPE)
27-
message(WARNING "Single-configuration generators require CMAKE_BUILD_TYPE to be set.")
24+
# Warn if the user did not set a build type.
25+
if (NOT DEFINED CMAKE_BUILD_TYPE)
26+
message(SEND_ERROR "CMAKE_BUILD_TYPE should be set.")
2827
endif ()
2928

3029
# Windows has file name length restrictions and lacks an RPATH mechanism.

0 commit comments

Comments
 (0)