summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* Fix compiler extension in standalone modeserge-sans-paille2020-06-171-0/+1
| | | | | | | | | | | | Use a dedicated cmake file to store the extension configured within LLVM. That way, a standalone build of clang can load this cmake file and get all the configured standalone extensions. This patch is related to https://reviews.llvm.org/D74602 Differential Revision: https://reviews.llvm.org/D74757 (cherry picked from commit 3a0f6e699bb6d96dc62dce6faef20ac26cf103fd)
* [llvm] [cmake] Provide split include paths in LLVMConfigMichal Gorny2019-02-131-0/+8
| | | | | | | | | | | | | | | | Modify LLVMConfig to provide split variables for in-source and generated include paths. Currently, it uses a single value for both LLVM_INCLUDE_DIRS and LLVM_INCLUDE_DIR which works for install tree but fails hard at build tree (where LLVM_INCLUDE_DIR incorrectly contains multiple values). Instead, put the generated directory in LLVM_INCLUDE_DIR, and the source tree in LLVM_MAIN_INCLUDE_DIR which is consistent with in-LLVM builds. For install tree, both variables will have the same value. Differential Revision: https://reviews.llvm.org/D58109 llvm-svn: 353924
* [CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPESChris Bieneman2018-10-151-1/+1
| | | | | | | | | | | | There are several places where we use CMAKE_CONFIGURATION_TYPES to determine if we are using an IDE generator and in turn decide not to generate some of the convenience targets (like all the install-* and check-llvm-* targets). This decision is made because IDEs don't always deal well with the thousands of targets LLVM can generate. This approach does not work for Visual Studio 15's new CMake integration. Because VS15 uses a Ninja generator, it isn't a multi-configuration build, and generating all these extra targets mucks up the UI and adds little value. With this change we still don't generate these targets by default for Visual Studio and Xcode generators, and LLVM_ENABLE_IDE becomes a switch that can be enabled on the VS15 CMake builds, to improve the IDE experience. This is a re-land of r340435, with a few minor fix-ups. The issues causing the revert were addressed in r344218, r344219, and r344553. llvm-svn: 344555
* Revert "[CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES"Roman Lebedev2018-08-301-1/+1
| | | | | | | | | | | | That resulted in the check-llvm-* targets not being avaliable in the QtCreator-configured build directories. Moreover, that was a clearly non-NFC change, and i can't find any review for it. This reverts commit rL340435. llvm-svn: 341045
* [CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPESChris Bieneman2018-08-221-1/+1
| | | | | | | | | | There are several places where we use CMAKE_CONFIGURATION_TYPES to determine if we are using an IDE generator and in turn decide not to generate some of the convenience targets (like all the install-* and check-llvm-* targets). This decision is made because IDEs don't always deal well with the thousands of targets LLVM can generate. This approach does not work for Visual Studio 15's new CMake integration. Because VS15 uses a Ninja generator, it isn't a multi-configuration build, and generating all these extra targets mucks up the UI and adds little value. With this change we still don't generate these targets by default for Visual Studio and Xcode generators, and LLVM_ENABLE_IDE becomes a switch that can be enabled on the VS15 CMake builds, to improve the IDE experience. llvm-svn: 340435
* [CMake] Followup for r337366: Only export LLVM_LINK_LLVM_DYLIB if it's set to ONPhilip Pfaffe2018-07-271-0/+6
| | | | | | | | | | | | | | | | | | Summary: As it was, always exporting LLVM_LINK_LLVM_DYLIB caused out-of-tree clients to lose the ability to link against the dylib, even if in-tree tools did not. By only exporting the setting if it is enabled, out-of-tree clients get the correct default, but may still choose if they can. Reviewers: mgorny, beanz, labath, bogner, chandlerc Reviewed By: bogner, chandlerc Subscribers: bollu, llvm-commits Differential Revision: https://reviews.llvm.org/D49843 llvm-svn: 338119
* [llvm] Add stripped installation targetsShoaib Meenai2017-11-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | CMake's generated installation scripts support `CMAKE_INSTALL_DO_STRIP` to enable stripping the installed binaries. LLVM's build system doesn't expose this option to the `install-` targets, but it's useful in conjunction with `install-distribution`. Add a new function to create the install targets, which creates both the regular install target and a second install target that strips during installation. Change the creation of all installation targets to use this new function. Stripping doesn't make a whole lot of sense for some installation targets (e.g. the LLVM headers), but consistency doesn't hurt. I'll make other repositories (e.g. clang, compiler-rt) use this in a follow-up, and then add an `install-distribution-stripped` target to actually accomplish the end goal of creating a stripped distribution. I don't want to do that step yet because the creation of that target would depend on the presence of the `install-*-stripped` target for each distribution component, and the distribution components from other repositories will be missing that target right now. Differential Revision: https://reviews.llvm.org/D40620 llvm-svn: 319480
* cmake: Don't try to install exports if there aren't anyJustin Bogner2016-11-081-2/+5
| | | | | | | | | When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for LLVM's export list to be empty. If this happens the install(EXPORTS) command will fail, but since there isn't anything to install anyway we really just want to skip it. llvm-svn: 286209
* cmake: Make /usr/share/cmake installable with LLVM_DISTRIBUTION_COMPONENTSJustin Bogner2016-10-241-2/+14
| | | | | | | Add a cmake-exports install component and appropriate targets for LLVM_DISTRIBUTION_COMPONENTS to work with. llvm-svn: 285030
* [CMake] Exclude intrinsics_gen from LLVM_COMMON_DEPENDS in LLVMConfig.cmakeChris Bieneman2016-10-041-0/+9
| | | | | | CMake requires that all targets expressed as dependencies exist, so we can't have intrinsics_gen in LLVM_COMMON_DEPENDS when it is written out, otherwise projects building out of tree will have CMake errors. llvm-svn: 283234
* [cmake] Fix a stale comment from an earlier version of r281085. NFC.Michael Gottesman2016-09-091-2/+1
| | | | llvm-svn: 281086
* [cmake] Export gtest/gtest_main and its dependencies via a special build ↵Michael Gottesman2016-09-091-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tree only cmake exports file. Previously, gtest/gtest_main were not exported via cmake. The intention here was to ensure that users whom are linking against the LLVM install tree would not get the gtest/gtest_main targets. This prevents downstream projects that link against the LLVM build tree (i.e. Swift) from getting this dependency information in their cmake builds. Without such dependency information, linker issues can result on linux due to LLVMSupport being put before gtest on the linker command line. This commit preserves behavior that we want for the install tree, while adding support for the build tree by: 1. The special casing for gtest/gtest_main in the add_llvm_library code is removed in favor of a flag called "BUILDTREE_ONLY". If this is set, then the library is communicating that it is only meant to be exported into the build tree and is not meant to be installed or exported via the install tree. This part is just a tweak to remove the special case, the underlying code is the same. 2. The cmake code that exports cmake targets for the build tree has special code to import an additional targets file called LLVMBuildTreeOnlyExports.cmake. Additionally the extra targets are added to the LLVMConfig.cmake's LLVM_EXPORTED_TARGETS variable. In contrast, the "installation" cmake file uses the normal LLVM_EXPORTS_TARGETS as before and does not include the extra exports file. This is implemented by defining/undefining variables when performing a configure of the build/install tree LLVMConfig.cmake files. llvm-svn: 281085
* cmake: Install CheckAtomic.cmake (needed by lldb)Chris Bieneman2016-08-251-2/+1
| | | | | | | | | | | | | | | Summary: Install CheckAtomic.cmake along with other LLVM modules, therefore making it possible for other projects to use it. This file is needed for LLDB to be built standalone, and installing it was suggested in https://reviews.llvm.org/D23881. Patch by: Michał Górny Reviewers: krytarowski, zturner, eugenis, jyknight, labath, beanz Subscribers: beanz, llvm-commits Differential Revision: https://reviews.llvm.org/D23887 llvm-svn: 279777
* [CMake] LLVM_BINARY_DIR was not being properly set in LLVMConfig.cmakeChris Bieneman2016-06-221-0/+2
| | | | | | LLVMConfig.cmake needs to set LLVM_BINARY_DIR differently based on whether or not it is the build directory or the install directory. The build directory just needs to set the value from the configuration, the install directory needs to set it to the install prefix. llvm-svn: 273479
* Install cmake files to lib/cmake/llvmNiels Ole Salscheider2016-02-041-1/+1
| | | | | | | | | | | This is the right location for platform-specific files. On some distributions (e. g. Exherbo), a package can be installed for several architectures in parallel, but the architecture-independent files are shared. Therefore, we must not install architecture-dependent files (like the CMake config and export files) to share/. llvm-svn: 259821
* [CMake] Need to install VersionFromVCS.cmake as part of LLVM's CMake modulesChris Bieneman2016-01-151-1/+0
| | | | | | This is required to support clang --version detecting the clang repository information. llvm-svn: 257909
* [cmake] Start making LLVM_LIBDIR_SUFFIX effective by adding it toChandler Carruth2014-12-291-1/+1
| | | | | | | | | | | | | | | | | *numerous* places where it was missing in the CMake build. The primary change here is that the suffix is now actually used for all of the lib directories in the LLVM project's CMake. The various subprojects still need similar treatment. This is the first of a series of commits to try to make LLVM's cmake effective in a multilib Linux installation. I don't think many people are seriously using this variable so I'm hoping the fallout will be minimal. A somewhat unfortunate consequence of the nature of these commits is that until I land all of them, they will in part make the brokenness of our multilib support more apparant. At the end, things should actually work. llvm-svn: 224919
* Add LLVM_TOOLS_BINARY_DIR variable to LLVMConfig.cmake so clientsDan Liew2014-07-221-1/+2
| | | | | | | | | of LLVM using CMake can easily find the tools directory. LLVM_BUILD_TOOLS_BINARY_DIR was removed because it is now superfluous. llvm-svn: 213674
* Export LLVM_ENABLE_ASSERTIONS in LLVMConfig.cmake so clients knowDan Liew2014-07-211-1/+0
| | | | | | | if the version of LLVM they are trying to use was built with or without assertions. llvm-svn: 213532
* Teach LLVM-Config to use logical target names (2/2)NAKAMURA Takumi2014-02-211-2/+2
| | | | | | | | | | | | | The module still needs to collect the list of all available libraries in order to satisfy the 'all' component. Provide this in the package configuration file, 'LLVMConfig.cmake', as a LLVM_AVAILABLE_LIBS variable. (A variable is scoped better than a global property.) Since this won't be set for our own build, fall back to looking up the LLVM_LIBS property to get the value when it is not set. Contributed by Brad King. llvm-svn: 201853
* cmake: Do not export targets when installing toolchain onlyReid Kleckner2014-02-101-2/+2
| | | | | | Patch by Brad King! llvm-svn: 201111
* Load exported lib and exe targets from LLVMConfigNAKAMURA Takumi2014-02-091-0/+2
| | | | | | | | | | | | | Teach each package configuration file to load the LLVMExports file for its corresponding tree. This will allow application CMake code to use logical library and executable target names from LLVM as if they were in our own build process (e.g. LLVMSupport). CMake will have enough information to propagate LLVM library link dependencies automatically while configuring applications. Contributed by Brad King. llvm-svn: 201051
* Export lib and exe build target names from build treeNAKAMURA Takumi2014-02-091-0/+4
| | | | | | | | | | | | | | | Record every logical target that we install with install(TARGETS) in a global LLVM_EXPORTS property. Then use the export(TARGETS) command to provide a "LLVMExports.cmake" file that exports logical targets for import into applications directly from our build tree. The "LLVMExports.cmake" file is not meant for direct inclusion by application code but should be included by "LLVMConfig.cmake" in a future change. Contributed by Brad King. llvm-svn: 201050
* Export lib and exe build target names from install treeNAKAMURA Takumi2014-02-091-0/+2
| | | | | | | | | | | | | | | Use the install(TARGETS) command EXPORT option for every library and executable that we install with LLVM. Then use the install(EXPORT) command to provide a "LLVMExports.cmake" file that exports logical targets for import into applications from our install tree. The "LLVMExports.cmake" file is not meant for direct inclusion by application code but should be included by "LLVMConfig.cmake" in a future change. Contributed by Brad King. llvm-svn: 201049
* Provide LLVMConfig in both build and install treeNAKAMURA Takumi2014-02-091-2/+39
| | | | | | | | | | | | | | | | | | Create separate package configuration files "LLVMConfig.cmake" for the LLVM build and install trees so that each can have information specific to its tree. Configure each with the corresponding include, lib, and cmake directories. Include the "LLVM-Config" API modules directly from the configured cmake modules directory. In the install tree, compute the installation prefix relative to the file location. In the build tree, provide information specific to the build tree for use by tools like Clang that can build externally against the LLVM build tree. Prefix such values in "LLVM_BUILD_" and comment them as such. Contributed by Brad King. llvm-svn: 201048
* Teach LLVMConfig to avoid modifying CMAKE_MODULE_PATHNAKAMURA Takumi2014-02-091-0/+10
| | | | | | | | | | | | Do not modify this value on the application's behalf and just ensure API modules are always available next to the LLVMConfig module. This is already the case in the install tree so use file(COPY) to make it so in the build tree. Include the LLVM-Config API module from next to the LLVMConfig location. Contributed by Brad King. llvm-svn: 201047
* De-duplicate references to share/llvm/cmake pathNAKAMURA Takumi2014-02-091-3/+4
| | | | | | | | | Use a LLVM_INSTALL_PACKAGE_DIR variable to hold the path and reference it where necessary. Contributed by Brad King. llvm-svn: 201046
* CMake: Add LLVM_INSTALL_TOOLCHAIN_ONLY option.Hans Wennborg2013-08-241-15/+17
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1428 llvm-svn: 189155
* Undo an over zealous rename. This bit of the CMake build really isChandler Carruth2012-01-241-1/+1
| | | | | | | dealing in the host triple, be honest about it and document the decision to default the target triple to the host triple unless overridden. llvm-svn: 148822
* build/cmake: Switch to using llvm-build computed dependencies.Daniel Dunbar2011-11-291-2/+2
| | | | | | | | - I verified locally that the current dependency lists are identical. - This makes add_llvm_library_dependencies() a no-op. I'll remove it once this change passes the bots. llvm-svn: 145355
* Complete the removal of FindBison from CMake. Noticed this when browsingChandler Carruth2011-09-041-1/+0
| | | | | | some CMake patch backlog... llvm-svn: 139107
* Make my attempt to build up global deps variables actually utilizeChandler Carruth2011-07-291-0/+6
| | | | | | | | globally scoped constructs. Also, round-trip these dependencies through the LLVMConfig.cmake.in file thata is used by CMake-based clients of "installed" (or built) LLVM trees. llvm-svn: 136543
* Rewrite the CMake build to use explicit dependencies between libraries,Chandler Carruth2011-07-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specified in the same file that the library itself is created. This is more idiomatic for CMake builds, and also allows us to correctly specify dependencies that are missed due to bugs in the GenLibDeps perl script, or change from compiler to compiler. On Linux, this returns CMake to a place where it can relably rebuild several targets of LLVM. I have tried not to change the dependencies from the ones in the current auto-generated file. The only places I've really diverged are in places where I was seeing link failures, and added a dependency. The goal of this patch is not to start changing the dependencies, merely to move them into the correct location, and an explicit form that we can control and change when necessary. This also removes a serialization point in the build because we don't have to scan all the libraries before we begin building various tools. We no longer have a step of the build that regenerates a file inside the source tree. A few other associated cleanups fall out of this. This isn't really finished yet though. After talking to dgregor he urged switching to a single CMake macro to construct libraries with both sources and dependencies in the arguments. Migrating from the two macros to that style will be a follow-up patch. Also, llvm-config is still generated with GenLibDeps.pl, which means it still has slightly buggy dependencies. The internal CMake 'llvm-config-like' macro uses the correct explicitly specified dependencies however. A future patch will switch llvm-config generation (when using CMake) to be based on these deps as well. This may well break Windows. I'm getting a machine set up now to dig into any failures there. If anyone can chime in with problems they see or ideas of how to solve them for Windows, much appreciated. llvm-svn: 136433
* CMake: remove some unnecesary code and ToDos.Oscar Fuentes2011-04-111-8/+0
| | | | | | Patch by arrowdodger! llvm-svn: 129274
* CMake: support for using LLVM from client projects with find_package.Oscar Fuentes2011-04-101-5/+15
| | | | | | Patch by arrowdodger! llvm-svn: 129247
* Rename LLVMConfig.cmake to LLVM-Config.cmake. The *Config.cmake namingOscar Fuentes2011-04-051-3/+3
| | | | | | scheme is used by the functionality related to find_package. llvm-svn: 128889
* CMake: remove unnecessary variable.Oscar Fuentes2011-02-221-1/+0
| | | | llvm-svn: 126224
* Move library stuff out of the toplevel CMakeLists.txt file.Oscar Fuentes2011-02-181-0/+3
| | | | llvm-svn: 125968
* Install only *.cmake files. Don't install .svn directory.Oscar Fuentes2011-02-071-1/+2
| | | | | | Fixes PR9159. llvm-svn: 125001
* Changes for building Clang and others using LLVM as an externalOscar Fuentes2011-02-031-0/+17
| | | | | | | | | | | | | library. Installs tblgen (required by Clang). Translates handling of user settings and platform-dependant options to its own file, where it can included by another project. Installs the .cmake files required by projects like Clang. llvm-svn: 124816
* Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."Michael J. Spencer2010-09-131-14/+8
| | | | | | | | | | This reverts commit r113632 Conflicts: cmake/modules/AddLLVM.cmake llvm-svn: 113819
* CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.Michael J. Spencer2010-09-101-8/+14
| | | | llvm-svn: 113632
* CMake: corrections on LLVM.cmake external services.Oscar Fuentes2010-08-111-1/+2
| | | | llvm-svn: 110763
* CMake: system for providing llvm-config-like features to the user.Oscar Fuentes2010-08-091-0/+11
The user can use a cmake function for obtaining the LLVM libraries corresponding to a list of LLVM components. llvm-svn: 110560
OpenPOWER on IntegriCloud