CMake: Fix how missing backends are handled
- Replace references to the deleted null_backend.py script with an error
message in CMake.
- Add the missing pw_log_null module.
Change-Id: I7b279cff0c6cd61e97d9c3a622ffd37449319e31
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/44600
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9447bda..17ce39b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@
add_subdirectory(pw_kvs EXCLUDE_FROM_ALL)
add_subdirectory(pw_log EXCLUDE_FROM_ALL)
add_subdirectory(pw_log_basic EXCLUDE_FROM_ALL)
+add_subdirectory(pw_log_null EXCLUDE_FROM_ALL)
add_subdirectory(pw_log_tokenized EXCLUDE_FROM_ALL)
add_subdirectory(pw_minimal_cpp_stdlib EXCLUDE_FROM_ALL)
add_subdirectory(pw_polyfill EXCLUDE_FROM_ALL)
diff --git a/pw_build/docs.rst b/pw_build/docs.rst
index a5d38da..c974828 100644
--- a/pw_build/docs.rst
+++ b/pw_build/docs.rst
@@ -399,8 +399,8 @@
├── file1.txt
└── renamed.txt
-CMake / Ninja
-=============
+CMake
+=====
Pigweed's `CMake`_ support is provided primarily for projects that have an
existing CMake build and wish to integrate Pigweed without switching to a new
build system.
diff --git a/pw_build/pigweed.cmake b/pw_build/pigweed.cmake
index 2d0fa3f..a004cd4 100644
--- a/pw_build/pigweed.cmake
+++ b/pw_build/pigweed.cmake
@@ -219,7 +219,12 @@
# instead. If the facade is used in the build, it fails with this error.
add_custom_target("${NAME}._no_backend_set_message"
COMMAND
- python "$ENV{PW_ROOT}/pw_build/py/pw_build/null_backend.py" "${NAME}"
+ "${CMAKE_COMMAND}" -E echo
+ "ERROR: Attempted to build the ${NAME} facade with no backend."
+ "Configure the ${NAME} backend using pw_set_backend or remove all dependencies on it."
+ "See https://pigweed.dev/pw_build."
+ COMMAND
+ "${CMAKE_COMMAND}" -E false
)
add_library("${NAME}.NO_BACKEND_SET" INTERFACE)
add_dependencies("${NAME}.NO_BACKEND_SET" "${NAME}._no_backend_set_message")
diff --git a/pw_protobuf_compiler/proto.cmake b/pw_protobuf_compiler/proto.cmake
index 2410c5d..b7a4643 100644
--- a/pw_protobuf_compiler/proto.cmake
+++ b/pw_protobuf_compiler/proto.cmake
@@ -223,12 +223,12 @@
if("${dir_pw_third_party_nanopb}" STREQUAL "")
add_custom_target("${NAME}._generate.nanopb"
- cmake -E echo
+ "${CMAKE_COMMAND}" -E echo
ERROR: Attempting to use pw_proto_library, but
dir_pw_third_party_nanopb is not set. Set dir_pw_third_party_nanopb
to the path to the Nanopb repository.
COMMAND
- cmake -E false
+ "${CMAKE_COMMAND}" -E false
DEPENDS
${DEPS}
SOURCES