Discussion:
[CMake] load CMakeCache.txt settings into new build directory?
Ian Monroe
2009-04-06 21:38:36 UTC
Permalink
I want to write a script that, in response to 'make distcheck', git
clones the source repo into a new directory under the build directory,
builds it and runs make test.

The issue is that if the user had to tweak their cmake settings to get
it to build thats not going to work, since the new build directory
would need to be similarly tweaked.

Is there a solution to this?

Ian
Michael Jackson
2009-04-07 02:33:51 UTC
Permalink
I _think_ the way to do this in your script would be to use either one
of:

-C <initial-cache> = Pre-load a script to populate the
cache.
-D <var>:<type>=<value> = Create a cmake cache entry.

In the -C variant you would have a *.cmake file that has all the
necessary entries in it that you want to set, or want the user to
automatically have. I think you just use the normal cmake syntax:

set(CMAKE_BUILD_TYPE "Debug")

In the -D variant you would need to pass in all the settings that you
need on the command line:

cmake -D CMAKE_BUILD_TYPE:STRING=Debug ../SourceDirectory


Your choice.

_________________________________________________________
Mike Jackson ***@bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
Post by Ian Monroe
I want to write a script that, in response to 'make distcheck', git
clones the source repo into a new directory under the build directory,
builds it and runs make test.
The issue is that if the user had to tweak their cmake settings to get
it to build thats not going to work, since the new build directory
would need to be similarly tweaked.
Is there a solution to this?
Ian
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
http://www.cmake.org/mailman/listinfo/cmake
John Drescher
2009-04-07 02:40:39 UTC
Permalink
On Mon, Apr 6, 2009 at 10:33 PM, Michael Jackson
 -C <initial-cache>          = Pre-load a script to populate the cache.
 -D <var>:<type>=<value>     = Create a cmake cache entry.
In the -C variant you would have a *.cmake file that has all the necessary
entries in it that you want to set, or want the user to automatically have.
set(CMAKE_BUILD_TYPE "Debug")
In the -D variant you would need to pass in all the settings that you need
cmake -D CMAKE_BUILD_TYPE:STRING=Debug ../SourceDirectory
Thanks. Although I was not the OP I will look in to this so I can
simplify having others install of some libs with the options that I
want / need. Looks like this will save me some time making a step by
step guide...

John
Ian Monroe
2009-04-07 13:50:51 UTC
Permalink
On Mon, Apr 6, 2009 at 10:33 PM, Michael Jackson
 -C <initial-cache>          = Pre-load a script to populate the cache.
 -D <var>:<type>=<value>     = Create a cmake cache entry.
In the -C variant you would have a *.cmake file that has all the necessary
entries in it that you want to set, or want the user to automatically have.
set(CMAKE_BUILD_TYPE "Debug")
In the -D variant you would need to pass in all the settings that you need
cmake -D CMAKE_BUILD_TYPE:STRING=Debug ../SourceDirectory
But I don't really know what the users needs. Like for me I don't need
to pass any options. Others might have had to tweak things to
recognize a given library.

I wonder if I could just run a find&replace regex on the
CMakeCache.txt to change the build directory.

Ian
John Drescher
2009-04-07 14:04:15 UTC
Permalink
---------- Forwarded message ----------
From: John Drescher <***@gmail.com>
Date: Tue, Apr 7, 2009 at 10:04 AM
Subject: Re: [CMake] load CMakeCache.txt settings into new build directory?
Post by Ian Monroe
But I don't really know what the users needs. Like for me I don't need
to pass any options. Others might have had to tweak things to
recognize a given library.
I wonder if I could just run a find&replace regex on the
CMakeCache.txt to change the build directory.
I am pretty sure I have done that manually with itk or vtk to avoid
having to figure out what I set during a version upgrade.

John
--
John M. Drescher
Ian Monroe
2009-04-07 17:25:24 UTC
Permalink
Post by John Drescher
Post by Ian Monroe
But I don't really know what the users needs. Like for me I don't need
to pass any options. Others might have had to tweak things to
recognize a given library.
I wonder if I could just run a find&replace regex on the
CMakeCache.txt to change the build directory.
I am pretty sure I have done that manually with itk or vtk to avoid
having to figure out what I set during a version upgrade.
Yep turns out it works well. For some reason I didn't think it'd be that easy.

Ian

Loading...