summaryrefslogtreecommitdiff
path: root/clang/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <shal1t712@gmail.com>2016-12-31 05:25:52 +0000
committerAlexander Shaposhnikov <shal1t712@gmail.com>2016-12-31 05:25:52 +0000
commite24933a3ec0f75c0f7a7236113e4724769a1c5d3 (patch)
tree335007038158da66a8dcc7d3e7a7579c2ac78a23 /clang/CMakeLists.txt
parentba5a4b9ecdaaa0cc709f0d6a76104af9384edad3 (diff)
[clang] Fix clean build of generate-order-file
This diff fixes the clean build of the target generate-order-file. In llvm/tools/clang/CMakeLists.txt add_subdirectory(utils/perf-training) should go after the block where the value of the variable CLANG_ORDER_FILE is set - otherwise (tested with cmake's version 3.6.2) the arguments of perf-helper.py gen-order-file will be ill-formed (CLANG_ORDER_FILE will be empty). Differential revision: https://reviews.llvm.org/D28153
Diffstat (limited to 'clang/CMakeLists.txt')
-rw-r--r--clang/CMakeLists.txt46
1 files changed, 23 insertions, 23 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 509c7a428f6..c09b75f990e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -421,6 +421,29 @@ else()
endif()
add_subdirectory(examples)
+if(APPLE)
+ # this line is needed as a cleanup to ensure that any CMakeCaches with the old
+ # default value get updated to the new default.
+ if(CLANG_ORDER_FILE STREQUAL "")
+ unset(CLANG_ORDER_FILE CACHE)
+ unset(CLANG_ORDER_FILE)
+ endif()
+
+
+ set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
+ "Order file to use when compiling clang in order to improve startup time (Darwin Only - requires ld64).")
+
+ if(NOT EXISTS ${CLANG_ORDER_FILE})
+ string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
+ if(PATH_START EQUAL 0)
+ file(WRITE ${CLANG_ORDER_FILE} "\n")
+ else()
+ message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not exist.")
+ endif()
+ endif()
+endif()
+
+
if( CLANG_INCLUDE_TESTS )
if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
@@ -455,29 +478,6 @@ if( CLANG_INCLUDE_DOCS )
add_subdirectory(docs)
endif()
-
-if(APPLE)
- # this line is needed as a cleanup to ensure that any CMakeCaches with the old
- # default value get updated to the new default.
- if(CLANG_ORDER_FILE STREQUAL "")
- unset(CLANG_ORDER_FILE CACHE)
- unset(CLANG_ORDER_FILE)
- endif()
-
-
- set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
- "Order file to use when compiling clang in order to improve startup time (Darwin Only - requires ld64).")
-
- if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
- string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
- if(PATH_START EQUAL 0)
- file(WRITE ${CLANG_ORDER_FILE} "\n")
- else()
- message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not exist.")
- endif()
- endif()
-endif()
-
add_subdirectory(cmake/modules)
if(CLANG_STAGE)