How to use CMAKE_INSTALL_PREFIX

后端 未结 3 1662
情话喂你
情话喂你 2020-11-29 19:26

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,

3条回答
  •  无人及你
    2020-11-29 20:14

    There are two ways to use this variable:

    • passing it as a command line argument just like Job mentioned:

      cmake -DCMAKE_INSTALL_PREFIX=< install_path > ..

    • assigning value to it in CMakeLists.txt:

      SET(CMAKE_INSTALL_PREFIX < install_path >)

      But do remember to place it BEFORE PROJECT(< project_name>) command, otherwise it will not work!

提交回复
热议问题