Difference between revisions of "CMake:Multiple versions"

From KitwarePublic
Jump to navigationJump to search
(New page: Multiple versions)
 
m
Line 3: Line 3:
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.
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.


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 at [[Static libraries]].
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 at [[CMake:Static libraries]].

Revision as of 17:03, 9 November 2008

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.

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 too late). If XXX_DIR is changed, the advanced entries should be recomputed. CMake currently makes this awkward, but the FindPackageMultipass module provides some help. For example usage, see FindPETSc.cmake or 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.

Handling multiple versions correctly with wrapper compilers, Makefile includes, and pkg-config requires preserving the semantics of the linker. See ResolveCompilerPaths and the discussion at CMake:Static libraries.