[CMake] LLVM_PROFDATA_FILE only works if you're using clang, so we should error out...
authorChris Bieneman <beanz@apple.com>
Tue, 13 Oct 2015 05:35:12 +0000 (05:35 +0000)
committerChris Bieneman <beanz@apple.com>
Tue, 13 Oct 2015 05:35:12 +0000 (05:35 +0000)
Also updated the CMake docs.

Based on post-commit review of r250108 from Sean Silvas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250150 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
docs/CMake.rst

index 2a2291c78228131aa86cb3ad49a9cad7c09e922a..d420e64228ad0659fa1e52a6712f55e28a581d6b 100644 (file)
@@ -594,7 +594,11 @@ set(LLVM_PROFDATA_FILE "" CACHE FILEPATH
   "Profiling data file to use when compiling in order to improve runtime performance.")
 
 if(LLVM_PROFDATA_FILE AND EXISTS ${LLVM_PROFDATA_FILE})
   "Profiling data file to use when compiling in order to improve runtime performance.")
 
 if(LLVM_PROFDATA_FILE AND EXISTS ${LLVM_PROFDATA_FILE})
-  add_definitions("-fprofile-instr-use=${LLVM_PROFDATA_FILE}")
+  if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+    add_definitions("-fprofile-instr-use=${LLVM_PROFDATA_FILE}")
+  else()
+    message(FATAL_ERROR "LLVM_PROFDATA_FILE can only be specified when compiling with clang")
+  endif()
 endif()
 
 include(AddLLVM)
 endif()
 
 include(AddLLVM)
index 49657ba2dd8699449152114ab03dc2f67585150a..0810bed90d4f5e532fe67bb0633e34ca6f299596 100644 (file)
@@ -334,6 +334,10 @@ LLVM-specific variables
 **LLVM_USE_OPROFILE**:BOOL
   Enable building OProfile JIT support. Defaults to OFF.
 
 **LLVM_USE_OPROFILE**:BOOL
   Enable building OProfile JIT support. Defaults to OFF.
 
+**LLVM_PROFDATA_FILE**:PATH
+  Path to a profdata file to pass into clang's -fprofile-instr-use flag. This
+  can only be specified if you're building with clang.
+
 **LLVM_USE_INTEL_JITEVENTS**:BOOL
   Enable building support for Intel JIT Events API. Defaults to OFF.
 
 **LLVM_USE_INTEL_JITEVENTS**:BOOL
   Enable building support for Intel JIT Events API. Defaults to OFF.