Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake preload script for cache

Tags:

build

cmake

I fire cmake with the -C mysettings.cmake.

The content of myfile.cmake is

set(CMAKE_INSTALL_PREFIX "C:/install/mylib" STRING)

Everything is generated but it seems the -C mysettings.cmake variable is not set. It is still installed in the default directory.

Cmake prints the message "loading initial cache file ../../script/cmake/mysettings.cmake" without any error.

The full call:

cmake -C ../../script/cmake/mysettings.cmake -G "Visual Studio 9 2008" ../../source/mylib

Is there something wrong with my syntax?

like image 845
Beachwalker Avatar asked Jul 11 '13 15:07

Beachwalker


1 Answers

From the CMake manual:

The given file should be a CMake script containing SET commands that use the CACHE option, not a cache-format file.

So your myfile.cmake needs to look something like this:

set(CMAKE_INSTALL_PREFIX "C:/install/mylib" CACHE PATH "")
like image 65
ComicSansMS Avatar answered Nov 03 '22 04:11

ComicSansMS