Skip to content

Commit a46be40

Browse files
committed
CMake: actually 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 a46be40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON)
2323

2424
# Warn if the user did not set a build type and is using a single-configuration generator.
2525
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.")
26+
if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)
27+
message(SEND_ERROR "Single-configuration generators require CMAKE_BUILD_TYPE to be set.")
2828
endif ()
2929

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

0 commit comments

Comments
 (0)