X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=CMakeLists.txt;h=d420e64228ad0659fa1e52a6712f55e28a581d6b;hb=405342d075da81d372f454193e1c3f22ffe1e734;hp=3e54ec991f17f3c0f92c91922721ea61fd7e85f4;hpb=4b5f4e5618d5daf8c5394ae0c22fa00ebc428cec;p=oota-llvm.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e54ec991f1..d420e64228a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -548,6 +548,8 @@ if(APPLE AND DARWIN_LTO_LIBRARY) "${CMAKE_EXE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") + set(CMAKE_MODULE_LINKER_FLAGS + "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") endif() # Work around a broken bfd ld behavior. When linking a binary with a @@ -588,6 +590,17 @@ endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) # use export_executable_symbols(target). set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +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}) + 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) include(TableGen)