Fixing quoting on cmake variables that *must* be quoted. (#4404)
diff --git a/build_tools/cmake/iree_macros.cmake b/build_tools/cmake/iree_macros.cmake
index 22d4ce9..7f1c85a 100644
--- a/build_tools/cmake/iree_macros.cmake
+++ b/build_tools/cmake/iree_macros.cmake
@@ -306,10 +306,10 @@
#
# Tests which only depend on a compiler target backend or a runtime HAL
# driver, but not both, should generally use a different method of filtering.
- if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV} OR NOT ${IREE_HAL_DRIVER_VULKAN})
+ if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}" OR NOT "${IREE_HAL_DRIVER_VULKAN}")
set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT "IREE_VULKAN_DISABLE=1")
endif()
- if(NOT ${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT} OR NOT ${IREE_HAL_DRIVER_DYLIB})
+ if(NOT "${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT}" OR NOT "${IREE_HAL_DRIVER_DYLIB}")
set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT "IREE_LLVMAOT_DISABLE=1")
endif()
endfunction()
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
index 8a4365e..3224513 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
@@ -22,7 +22,7 @@
iree_cmake_extra_content(
content = """
-if(NOT ${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT})
+if(NOT "${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT}")
return()
endif()
""",
diff --git a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
index 4b55865..ed3cdd8 100644
--- a/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/LLVM/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT})
+if(NOT "${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT}")
return()
endif()
diff --git a/iree/compiler/Dialect/HAL/Target/MetalSPIRV/BUILD b/iree/compiler/Dialect/HAL/Target/MetalSPIRV/BUILD
index b911d08..bef6123 100644
--- a/iree/compiler/Dialect/HAL/Target/MetalSPIRV/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/MetalSPIRV/BUILD
@@ -12,12 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content")
+
package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
licenses = ["notice"], # Apache 2.0
)
+iree_cmake_extra_content(
+ content = """
+if(NOT "${IREE_TARGET_BACKEND_METAL-SPIRV}")
+ return()
+endif()
+""",
+)
+
cc_library(
name = "MetalSPIRV",
srcs = ["MetalSPIRVTarget.cpp"],
diff --git a/iree/compiler/Dialect/HAL/Target/MetalSPIRV/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/MetalSPIRV/CMakeLists.txt
index 2934ce9..e78415c 100644
--- a/iree/compiler/Dialect/HAL/Target/MetalSPIRV/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/MetalSPIRV/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_METAL-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_METAL-SPIRV}")
return()
endif()
diff --git a/iree/compiler/Dialect/HAL/Target/SPIRVCommon/BUILD b/iree/compiler/Dialect/HAL/Target/SPIRVCommon/BUILD
index 49f5ccb..370a7dd 100644
--- a/iree/compiler/Dialect/HAL/Target/SPIRVCommon/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/SPIRVCommon/BUILD
@@ -22,7 +22,8 @@
iree_cmake_extra_content(
content = """
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV} AND NOT ${IREE_TARGET_BACKEND_METAL-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}" AND
+ NOT "${IREE_TARGET_BACKEND_METAL-SPIRV}")
return()
endif()
""",
diff --git a/iree/compiler/Dialect/HAL/Target/SPIRVCommon/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/SPIRVCommon/CMakeLists.txt
index 3d00575..62f1631 100644
--- a/iree/compiler/Dialect/HAL/Target/SPIRVCommon/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/SPIRVCommon/CMakeLists.txt
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV} AND NOT ${IREE_TARGET_BACKEND_METAL-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}" AND
+ NOT "${IREE_TARGET_BACKEND_METAL-SPIRV}")
return()
endif()
diff --git a/iree/compiler/Dialect/HAL/Target/VMLA/BUILD b/iree/compiler/Dialect/HAL/Target/VMLA/BUILD
index 7276df9..c3fde9d 100644
--- a/iree/compiler/Dialect/HAL/Target/VMLA/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/VMLA/BUILD
@@ -22,7 +22,7 @@
iree_cmake_extra_content(
content = """
-if(NOT ${IREE_TARGET_BACKEND_VMLA})
+if(NOT "${IREE_TARGET_BACKEND_VMLA}")
return()
endif()
""",
diff --git a/iree/compiler/Dialect/HAL/Target/VMLA/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/VMLA/CMakeLists.txt
index 8f6194d..b666d40 100644
--- a/iree/compiler/Dialect/HAL/Target/VMLA/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/VMLA/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_VMLA})
+if(NOT "${IREE_TARGET_BACKEND_VMLA}")
return()
endif()
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
index 4062aa6..92792eb 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/BUILD
@@ -22,7 +22,7 @@
iree_cmake_extra_content(
content = """
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}")
return()
endif()
""",
diff --git a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
index c230f04..7188ea1 100644
--- a/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
+++ b/iree/compiler/Dialect/HAL/Target/VulkanSPIRV/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}")
return()
endif()
diff --git a/iree/compiler/Dialect/Vulkan/Utils/test/BUILD b/iree/compiler/Dialect/Vulkan/Utils/test/BUILD
index e83bb2f..29aa3a5 100644
--- a/iree/compiler/Dialect/Vulkan/Utils/test/BUILD
+++ b/iree/compiler/Dialect/Vulkan/Utils/test/BUILD
@@ -23,7 +23,7 @@
iree_cmake_extra_content(
content = """
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}")
return()
endif()
""",
diff --git a/iree/compiler/Dialect/Vulkan/Utils/test/CMakeLists.txt b/iree/compiler/Dialect/Vulkan/Utils/test/CMakeLists.txt
index 50453b1..a4f0d04 100644
--- a/iree/compiler/Dialect/Vulkan/Utils/test/CMakeLists.txt
+++ b/iree/compiler/Dialect/Vulkan/Utils/test/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}")
return()
endif()
diff --git a/iree/samples/custom_modules/BUILD b/iree/samples/custom_modules/BUILD
index c980e20..3154cc3 100644
--- a/iree/samples/custom_modules/BUILD
+++ b/iree/samples/custom_modules/BUILD
@@ -23,7 +23,8 @@
iree_cmake_extra_content(
content = """
-if(NOT ${IREE_TARGET_BACKEND_VMLA} OR NOT ${IREE_HAL_DRIVER_VMLA})
+if(NOT "${IREE_TARGET_BACKEND_VMLA}" OR
+ NOT "${IREE_HAL_DRIVER_VMLA}")
return()
endif()
""",
diff --git a/iree/samples/custom_modules/CMakeLists.txt b/iree/samples/custom_modules/CMakeLists.txt
index f7942f7..0e93972 100644
--- a/iree/samples/custom_modules/CMakeLists.txt
+++ b/iree/samples/custom_modules/CMakeLists.txt
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_VMLA} OR NOT ${IREE_HAL_DRIVER_VMLA})
+if(NOT "${IREE_TARGET_BACKEND_VMLA}" OR
+ NOT "${IREE_HAL_DRIVER_VMLA}")
return()
endif()
diff --git a/iree/samples/vulkan/CMakeLists.txt b/iree/samples/vulkan/CMakeLists.txt
index 785eb2c..9dad3f3 100644
--- a/iree/samples/vulkan/CMakeLists.txt
+++ b/iree/samples/vulkan/CMakeLists.txt
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_TARGET_BACKEND_VULKAN-SPIRV} OR NOT ${IREE_HAL_DRIVER_VULKAN})
+if(NOT "${IREE_TARGET_BACKEND_VULKAN-SPIRV}" OR
+ NOT "${IREE_HAL_DRIVER_VULKAN}")
return()
endif()
diff --git a/iree/testing/vulkan/CMakeLists.txt b/iree/testing/vulkan/CMakeLists.txt
index 8b650aa..0384bc1 100644
--- a/iree/testing/vulkan/CMakeLists.txt
+++ b/iree/testing/vulkan/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT ${IREE_HAL_DRIVER_VULKAN} OR NOT ${IREE_BUILD_SAMPLES})
+if(NOT "${IREE_HAL_DRIVER_VULKAN}" OR NOT "${IREE_BUILD_SAMPLES}")
return()
endif()
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt
index 88c1940..c42269b 100644
--- a/iree/tools/CMakeLists.txt
+++ b/iree/tools/CMakeLists.txt
@@ -21,19 +21,19 @@
# Enable compiler targets based on options.
set(IREE_COMPILER_TARGETS "")
set(IREE_COMPILER_TARGET_COPTS "")
-if(${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT})
+if("${IREE_TARGET_BACKEND_DYLIB-LLVM-AOT}")
list(APPEND IREE_COMPILER_TARGETS iree::compiler::Dialect::HAL::Target::LLVM)
list(APPEND IREE_COMPILER_TARGET_COPTS "-DIREE_HAVE_LLVMAOT_TARGET")
endif()
-if(${IREE_TARGET_BACKEND_METAL-SPIRV})
+if("${IREE_TARGET_BACKEND_METAL-SPIRV}")
list(APPEND IREE_COMPILER_TARGETS iree::compiler::Dialect::HAL::Target::MetalSPIRV)
list(APPEND IREE_COMPILER_TARGET_COPTS "-DIREE_HAVE_METALSPIRV_TARGET")
endif()
-if(${IREE_TARGET_BACKEND_VMLA})
+if("${IREE_TARGET_BACKEND_VMLA}")
list(APPEND IREE_COMPILER_TARGETS iree::compiler::Dialect::HAL::Target::VMLA)
list(APPEND IREE_COMPILER_TARGET_COPTS "-DIREE_HAVE_VMLA_TARGET")
endif()
-if(${IREE_TARGET_BACKEND_VULKAN-SPIRV})
+if("${IREE_TARGET_BACKEND_VULKAN-SPIRV}")
list(APPEND IREE_COMPILER_TARGETS iree::compiler::Dialect::HAL::Target::VulkanSPIRV)
list(APPEND IREE_COMPILER_TARGET_COPTS "-DIREE_HAVE_VULKANSPIRV_TARGET")
endif()