MantisBT - CMake
View Issue Details
0014450CMakeCMakepublic2013-10-01 10:552014-03-05 09:58
georgeg 
 
highmajoralways
closedwon't fix 
Linuxopensuse12
CMake 2.8.10.2 
 
0014450: CMAKE_INSTALL_PREFIX scope
The goal is that to install subdirectory in a custom path (usualy a child of the top directory install path)
the top directory has no sources by itself but is only a container for the subdirectories (the root of a project with other subprojects)

running make install in top directory will not obey the CMAKE_INSTALL_PREFIX that we set in each subdirectory. instead, the default top directory CMAKE_INSTALL_PREFIX value is used
create one subdirectory and 2 cmake lists:
CMakeLists.txt:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(cmaketest)
ADD_SUBDIRECTORY(1)

1/CMakeLists.txt:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(cmaketest1)
SET(CMAKE_INSTALL_PREFIX /tmp/cmaketest/1)
MESSAGE ("1: CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
INSTALL(FILES 1.h DESTINATION include)
note the directory "1" must be created and a demo header file in it: "1.h"
No tags attached.
Issue History
2013-10-01 10:55georgegNew Issue
2013-10-01 11:21Brad KingNote Added: 0033959
2013-10-01 11:21Brad KingStatusnew => resolved
2013-10-01 11:21Brad KingResolutionopen => won't fix
2014-03-05 09:58Robert MaynardNote Added: 0035273
2014-03-05 09:58Robert MaynardStatusresolved => closed

Notes
(0033959)
Brad King   
2013-10-01 11:21   
CMake's install rules work with exactly one prefix which can be set at install time by the user or CPack. The prefix set during configuration is just a default. Installation does not support a per-directory prefix. To do that, use something like

 install(FILES 1.h DESTINATION ${LOCAL_PREFIX}include)

where the variable is set above that with code like

 set(LOCAL_PREFIX "1/")

For further help, please ask on the mailing list:

 http://www.cmake.org/mailman/listinfo/cmake [^]
(0035273)
Robert Maynard   
2014-03-05 09:58   
Closing resolved issues that have not been updated in more than 4 months