[CMake] More robust handling for bootstrap variables
authorChris Bieneman <beanz@apple.com>
Thu, 22 Sep 2016 00:18:12 +0000 (00:18 +0000)
committerChris Bieneman <beanz@apple.com>
Thu, 22 Sep 2016 00:18:12 +0000 (00:18 +0000)
Checking defined isn't good enough we also need to handle defined to empty string.

llvm-svn: 282125

clang/CMakeLists.txt

index 9b7322e..53e5f33 100644 (file)
@@ -611,7 +611,11 @@ if (CLANG_ENABLE_BOOTSTRAP)
   # Populate the passthrough variables
   foreach(variableName ${CLANG_BOOTSTRAP_PASSTHROUGH} ${_BOOTSTRAP_DEFAULT_PASSTHROUGH})
     if(DEFINED ${variableName})
-      string(REPLACE ";" "\;" value ${${variableName}})
+      if("${${variableName}}" STREQUAL "")
+        set(value "")
+      else()
+        string(REPLACE ";" "\;" value ${${variableName}})
+      endif()
       list(APPEND PASSTHROUGH_VARIABLES
         -D${variableName}=${value})
     endif()