llvm-project/llvm/examples/Bye/CMakeLists.txt
John Ericson feeff8a37c [llvm] Use GNUInstallDirs to support custom installation dirs
This is the patch for LLVM proper in my series for adding GNUInstallDirs support in all project.

Additionally:

Create a new `CACHE STRING` variable, `LLVM_EXAMPLES_INSTALL_DIR`, to control where the examples are installed on analogy with the other variables.

---

This patch supersedes D28234, which tried to do the same thing but hand-rolled without GNUInstallDirs.

This patch nearly reverts commit 3 0fc88bf1dc15a72e2d9809d28019d386b7a7cc0, which was a revert of a prior attempt."

(I had to add a space here or else Phabricator detects a reference cycle and won't let me do the form submit.)

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D100810
2022-01-08 00:47:31 +00:00

20 lines
665 B
CMake

if(LLVM_BYE_LINK_INTO_TOOLS)
message(WARNING "Setting LLVM_BYE_LINK_INTO_TOOLS=ON only makes sense for testing purpose")
endif()
# The plugin expects to not link against the Support and Core libraries,
# but expects them to exist in the process loading the plugin. This doesn't
# work with DLLs on Windows (where a shared library can't have undefined
# references), so just skip this example on Windows.
if (NOT WIN32)
add_llvm_pass_plugin(Bye
Bye.cpp
DEPENDS
intrinsics_gen
BUILDTREE_ONLY
)
install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endif()