[CMake] Don't modify `FUZZER_SUPPORTED_ARCH` is place.
authorDan Liew <dan@su-root.co.uk>
Sun, 28 Apr 2019 09:44:53 +0000 (09:44 +0000)
committerDan Liew <dan@su-root.co.uk>
Sun, 28 Apr 2019 09:44:53 +0000 (09:44 +0000)
On a Darwin host we were modifying the `FUZZER_SUPPORTED_ARCH` in place
which would strip out non-x86 architectures. This unhelpful if we
want to use `FUZZER_SUPPORTED_ARCH` later.

To fix this we introduce `FUZZER_TEST_ARCH` which is similar to what we
have for for the other sanitizers. For non-Darwin host platforms
`FUZZER_TEST_ARCH` is the same as `FUZZER_SUPPORTED_ARCH` but for Darwin
host platforms we use `darwin_filter_host_archs(...)` as the previous
code did.

llvm-svn: 359394

compiler-rt/test/fuzzer/CMakeLists.txt

index ef46ec4..d38ce47 100644 (file)
@@ -12,8 +12,9 @@ if (NOT COMPILER_RT_STANDALONE_BUILD)
   endif()
 endif()
 
+set(FUZZER_TEST_ARCH ${FUZZER_SUPPORTED_ARCH})
 if (APPLE)
-  darwin_filter_host_archs(FUZZER_SUPPORTED_ARCH FUZZER_SUPPORTED_ARCH)
+  darwin_filter_host_archs(FUZZER_SUPPORTED_ARCH FUZZER_TEST_ARCH)
 endif()
 
 if(COMPILER_RT_INCLUDE_TESTS)
@@ -45,7 +46,7 @@ macro(test_fuzzer stdlib)
     string(REGEX REPLACE "^.(.*)" "${first_letter}\\1" part "${part}")
     set(STDLIB_CAPITALIZED "${STDLIB_CAPITALIZED}${part}")
   endforeach()
-  foreach(arch ${FUZZER_SUPPORTED_ARCH})
+  foreach(arch ${FUZZER_TEST_ARCH})
     set(LIBFUZZER_TEST_COMPILER ${COMPILER_RT_TEST_COMPILER})
     get_test_cc_for_arch(${arch} LIBFUZZER_TEST_COMPILER LIBFUZZER_TEST_FLAGS)