MantisBT - CMake
View Issue Details
0009657CMakeCMakepublic2009-10-04 12:542009-10-05 11:09
Modestas Vainius 
Brad King 
normalmajoralways
closedfixed 
CMake-2-8 
 
0009657: Too low preference of /usr/local in CMAKE_SYSTEM_PREFIX_PATH
According to FHS [1], /usr/local "is for use by the system administrator when installing software locally". However, CMAKE_SYSTEM_PREFIX_PATH is set to

/
/usr
/usr/local

in Modules/Platform/UnixPaths.cmake:12. This way both /usr and / (software installed by system) are preferred to /usr/local (software installed by administrator). However, cmake should prefer the version installed by administrator if there is any. This is especially important for commands like FIND_PATH() which searches /include and /usr/include before /usr/local/include due to this bug. I believe the order should be:

/usr/local
/
/usr

Not sure if / and /usr should be reversed either but probably it is not that significant.

CMake 2.8-rc2 on Debian GNU/Linux. Applies to CMake 2.6 too.


1. http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY [^]
CMakeLists.txt
--------------
project(testproject C)
cmake_minimum_required(VERSION 2.6)
find_path(AAA_INCLUDE aaa.h)

Output
------
$ rm -f CMakeCache.txt ; strace -e trace=file -- cmake . 2>&1 | grep aaa.h

# Searches my $PATH
access("/mnt/sda2/usr/local/bin/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/sda2/usr/bin/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/bin/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/sda2/usr/games/aaa.h", R_OK) = -1 ENOENT (No such file or directory)

# Searches each <path>/include in ${CMAKE_SYSTEM_PREFIX_PATH}. Bug is evident.
access("/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/sda2/usr/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/mnt/sda2/usr/aaa.h", R_OK) = -1 ENOENT (No such file or directory)

# Searches each <path> in ${CMAKE_SYSTEM_INCLUDE_PATH}
access("/usr/include/w32api/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/X11R6/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/include/X11/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/opt/local/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/pkg/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/opt/csw/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/opt/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/openwin/include/aaa.h", R_OK) = -1 ENOENT (No such file or directory)
No tags attached.
related to 0010136closed Brad King CMake should prefer /usr over / 
Issue History
2009-10-04 12:54Modestas VainiusNew Issue
2009-10-04 15:18Bill HoffmanStatusnew => assigned
2009-10-04 15:18Bill HoffmanAssigned To => Brad King
2009-10-05 11:09Brad KingNote Added: 0017947
2009-10-05 11:09Brad KingStatusassigned => closed
2009-10-05 11:09Brad KingResolutionopen => fixed
2010-01-13 13:17Brad KingRelationship addedrelated to 0010136

Notes
(0017947)
Brad King   
2009-10-05 11:09   
Find locally installed software first
/cvsroot/CMake/CMake/Modules/Platform/UnixPaths.cmake,v <-- Modules/Platform/UnixPaths.cmake
new revision: 1.15; previous revision: 1.14