[llvm] r250150 - [CMake] LLVM_PROFDATA_FILE only works if you're using clang, so we should error out if it is specified when not using clang.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 22:35:13 PDT 2015


Author: cbieneman
Date: Tue Oct 13 00:35:12 2015
New Revision: 250150

URL: http://llvm.org/viewvc/llvm-project?rev=250150&view=rev
Log:
[CMake] LLVM_PROFDATA_FILE only works if you're using clang, so we should error out if it is specified when not using clang.

Also updated the CMake docs.

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

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/docs/CMake.rst

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=250150&r1=250149&r2=250150&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Tue Oct 13 00:35:12 2015
@@ -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})
-  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)

Modified: llvm/trunk/docs/CMake.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.rst?rev=250150&r1=250149&r2=250150&view=diff
==============================================================================
--- llvm/trunk/docs/CMake.rst (original)
+++ llvm/trunk/docs/CMake.rst Tue Oct 13 00:35:12 2015
@@ -334,6 +334,10 @@ LLVM-specific variables
 **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.
 




More information about the llvm-commits mailing list