option(LLVM_USE_SPLIT_DWARF
"Use -gsplit-dwarf when compiling llvm." OFF)
-option(WITH_POLLY "Build LLVM with Polly" ON)
-option(LINK_POLLY_INTO_TOOLS "Static link Polly into tools" ON)
+option(LLVM_POLLY_LINK_INTO_TOOLS "Statically link Polly into tools (if available)" ON)
+option(LLVM_POLLY_BUILD "Build LLVM with Polly" ON)
+
+if (EXISTS ${LLVM_MAIN_SRC_DIR}/tools/polly/CMakeLists.txt)
+ set(POLLY_IN_TREE TRUE)
+else()
+ set(POLLY_IN_TREE FALSE)
+endif()
+
+if (LLVM_POLLY_BUILD AND POLLY_IN_TREE)
+ set(WITH_POLLY ON)
+else()
+ set(WITH_POLLY OFF)
+endif()
+
+if (LLVM_POLLY_LINK_INTO_TOOLS AND WITH_POLLY)
+ set(LINK_POLLY_INTO_TOOLS ON)
+else()
+ set(LINK_POLLY_INTO_TOOLS OFF)
+endif()
# Define an option controlling whether we should build for 32-bit on 64-bit
# platforms, where supported.
option (LLVM_BUILD_EXTERNAL_COMPILER_RT
"Build compiler-rt as an external project." OFF)
-if(WITH_POLLY)
- if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/polly/CMakeLists.txt)
- set(WITH_POLLY OFF)
- endif()
-endif(WITH_POLLY)
-
-if (NOT WITH_POLLY)
- set(LINK_POLLY_INTO_TOOLS OFF)
-endif (NOT WITH_POLLY)
-
# You can configure which libraries from LLVM you want to include in the
# shared library by setting LLVM_DYLIB_COMPONENTS to a semi-colon delimited
# list of LLVM components. All component names handled by llvm-config are valid.