|
|
(2 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| When multiple ABI-incompatible versions of libraries are installed, it is likely that existing FindXXX modules will not be able to find a version in a nonstandard location, or will find a combination of libraries that produces a broken executable. Some will work correctly if XXX_DIR is set the first time CMake is run, but if the wrong version is found on the first pass (perhaps because the user didn't know they had to set this variable in advanced), the only way (short of manually editing a possibly huge number of advanced cache entries) to switch versions is to delete the cache and try again.
| | {{CMake/Template/Moved}} |
|
| |
|
| A suggestion is for all packages to make all the advanced XXX_INCLUDES, XXX_LIBRARIES, ... cache entries subordinate to an XXX_DIR cache entry (which takes precedence over an XXX_DIR environment variable. When XXX_DIR is set, it should take precedence over system search paths (i.e. must use HINTS because PATHS is searched [http://public.kitware.com/Bug/view.php?id=8035 too late]). If XXX_DIR is changed, the advanced entries should be recomputed. CMake currently makes this awkward, but the [http://github.com/jedbrown/cmake-modules/tree/master/FindPackageMultipass.cmake FindPackageMultipass] module provides some help. For example usage, see [http://github.com/jedbrown/cmake-modules/tree/master/FindPETSc.cmake FindPETSc.cmake] or [http://github.com/jedbrown/cmake-modules/tree/master/FindiMesh.cmake FindiMesh.cmake]. Since almost every package would be better with this behavior, maybe something similar could be incorporated in CMake or at least a nicer interface could be designed.
| | This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/Multiple-versions here]. |
| | |
| Handling multiple versions correctly with wrapper compilers, Makefile includes, and pkg-config requires preserving the semantics of the linker. See [http://github.com/jedbrown/cmake-modules/tree/master/ResolveCompilerPaths.cmake ResolveCompilerPaths] and the discussion of [[CMake:Static libraries| static libraries]].
| |
Latest revision as of 15:40, 30 April 2018