0

I'm using the line:

set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/INSTALL" CACHE PATH "Directory for sbnw installation")

as described in the docs to change the default install directory from C:/Program Files (x86)/SBNW to project_root/INSTALL. However, I still want users to still be able to choose the default install path. After using this command, the value of CMAKE_INSTALL_PREFIX is still C:/Program Files (x86)/SBNW. Does anybody know why?

CiaranWelsh
  • 7,014
  • 10
  • 53
  • 106
  • Where do you inserted this line into your `CMakeLists.txt`? It need to be set before the `project` command. – vre Feb 28 '20 at 21:27
  • Yep, this did the trick. Presumably then, the CMAKE* variables all need to be set before project? If you make this coment an answer I'll accept. – CiaranWelsh Feb 28 '20 at 21:30
  • There are already a few questions about this topic on the site, including [this](https://stackoverflow.com/a/20962671/3987854) answer and [this](https://stackoverflow.com/a/39485990/3987854) answer, which appear to be most relevant to your situation. – Kevin Feb 28 '20 at 21:52
  • Does this answer your question? [Setting CMAKE\_INSTALL\_PREFIX from CMakeLists.txt file](https://stackoverflow.com/questions/39481958/setting-cmake-install-prefix-from-cmakelists-txt-file) – vre Feb 28 '20 at 22:18
  • Thanks @squareskittles. Just marked it as a duplicate. – vre Feb 28 '20 at 22:21

0 Answers0