Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

linux - How to use CMAKE_INSTALL_PREFIX

I want to generate Makefile with install target, making installation to /usr instead of default /usr/local. Assuming that build directory is done in the source subdirectory, I execute:

cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..

CMakeCache.txt contains: CMAKE_INSTALL_PREFIX:PATH=/usr (OK?)

Now I execute:

make
make install

All files are still installed to usr/local. What is wrong?

Edit: There is no CMAKE_INSTALL_PREFIX in any of CMakeLists.txt project files. Before running cmake, I delete everything from the output directory. install directives in CMakeLists.txt look like:

install(TARGETS mylibrary DESTINATION lib)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

That should be (see the docs):

cmake -DCMAKE_INSTALL_PREFIX=/usr ..

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.5k users

...