但是请记住将其放置在PROJECT(<project_name>)命令之前,否则它将不起作用!
我使用cmake的第一周-在使用了几年的GNU自动工具之后-所以我仍然在学习(最好写m4宏),但是我认为在设置项目后修改CMAKE_INSTALL_PREFIX 是更好的地方。
CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
set (CMAKE_INSTALL_PREFIX /foo/bar/bubba)
message("CIP = ${CMAKE_INSTALL_PREFIX} (should be /foo/bar/bubba")
project (BarkBark)
message("CIP = ${CMAKE_INSTALL_PREFIX} (should be /foo/bar/bubba")
set (CMAKE_INSTALL_PREFIX /foo/bar/bubba)
message("CIP = ${CMAKE_INSTALL_PREFIX} (should be /foo/bar/bubba")
首次运行(无缓存)
CIP = /foo/bar/bubba (should be /foo/bar/bubba
-- The C compiler identification is GNU 4.4.7
-- etc, etc,...
CIP = /usr/local (should be /foo/bar/bubba
CIP = /foo/bar/bubba (should be /foo/bar/bubba
-- Configuring done
-- Generating done
第二次
CIP = /foo/bar/bubba (should be /foo/bar/bubba
CIP = /foo/bar/bubba (should be /foo/bar/bubba
CIP = /foo/bar/bubba (should be /foo/bar/bubba
-- Configuring done
-- Generating done
如果我弄错了,请告诉我,我有很多学习要做。好有趣。