Browse Source

CMake: make it possible to use <PackageName>_ROOT to locate dependencies.

pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
888ba08569
  1. 5
      CMakeLists.txt
  2. 10
      doc/building.dox
  3. 3
      doc/changelog.dox

5
CMakeLists.txt

@ -39,6 +39,11 @@ endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# Allow <PackageName>_ROOT to be used on 3.12+ to point to per-package install
# locations that find_package(PackageName) subsequently picks up
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Superprojects can use just set(MAGNUM_WITH_BLAH ON) without FORCE CACHE on
# 3.13+
if(POLICY CMP0077)

10
doc/building.dox

@ -371,7 +371,9 @@ See @ref building-features "below" for additional configuration options.
If you have the dependencies installed in non-standard location (other than
`/usr`, e.g. `/home/xyz/projects`), set `CMAKE_PREFIX_PATH` to that directory
to help CMake find them. You can enter more different dirs if you separate them
with semicolons.
with semicolons. On CMake 3.12+ you can also use `<PackageName>_ROOT` variables
to point to dependency-specific locations, e.g.
`-DCorrade_ROOT=/home/xyz/projects/corrade-install`.
Also, if you plan to install the library to non-standard location, you might
want to set `CMAKE_INSTALL_RPATH` to `lib/` subdir of given prefix (e.g.
@ -392,7 +394,7 @@ want to set `CMAKE_INSTALL_RPATH` to `lib/` subdir of given prefix (e.g.
On Windows you can use MSVC, clang-cl or the MinGW-w64 compiler. It's then up
to you whether you will use QtCreator, Visual Studio or another IDE or do the
build from a command line. Note that for most convenient usage it's best use
build from a command line. Note that for most convenient usage it's best to use
some dedicated directory (e.g. `C:/Sys`) for installing dependencies instead of
putting each dependency to its own directory in `C:/Program Files` or
elsewhere. Then you can just add its `bin/` subdir (e.g. `C:/Sys/bin`) to
@ -403,7 +405,9 @@ prepared for exactly this.
Then, when running CMake, set `CMAKE_PREFIX_PATH` and `CMAKE_INSTALL_PREFIX`
value to that directory (e.g. `-DCMAKE_INSTALL_PREFIX=C:/Sys`). If you have
dependencies scattered across multiple locations, enter them into
`CMAKE_PREFIX_PATH` separated with semicolons.
`CMAKE_PREFIX_PATH` separated with semicolons. On CMake 3.12+ you can also
use `<PackageName>_ROOT` variables to point to dependency-specific locations,
e.g. `-DCorrade_ROOT=C:/projects/corrade-install`.
@subsubsection building-windows-msvc Using Visual Studio

3
doc/changelog.dox

@ -733,6 +733,9 @@ See also:
- @ref Trade::ObjImporter "ObjImporter" uses exceptions internally and needs
an explicit exception-enabling flag when built with Emscripten 1.39.0 and
newer
- It's now possible to use `<PackageName>_ROOT` to point to install locations
of dependencies such as Corrade on CMake 3.12+, in addition to putting them
all together inside `CMAKE_PREFIX_PATH`. See also [mosra/magnum#614](https://github.com/mosra/magnum/issues/614).
- On CMake 3.16 and newer, `FindMagnum.cmake` can provide additional details
if some component is not found.
- The Homebrew package now uses `std_cmake_args` instead of hardcoded build

Loading…
Cancel
Save