[CMake] How to start CMake from scratch

Petr Kmoch petr.kmoch at gmail.com
Fri Apr 20 07:41:04 EDT 2012


I never used --build myself, but my guess is you can't generate and
build the project in a single step. I'd try the following (on a blank
setup):

cd test/B/build
cmake ..
cmake --build .

When running cmake from the command line to generate a buildsystem,
the source directory (where CMakeLists.txt is looked for) is specified
by the argument and the build directory (into which the buildsystem is
generated) is the one from which cmake is run.

Hope I've understood your question.

Petr

On Fri, Apr 20, 2012 at 11:52 AM, Christian Arnault
<arnault at lal.in2p3.fr> wrote:
> Hi
>
> [I am on windows]
>
> If I use cmake-gui to build my project, it starts asking me for the build
> directory. Which is OK!
>
> (my project is named "B", it stands in "test/B", where there is a
> "test/B/CMakeLists.txt" and I want to build into "test/B/build")
>
> Now, if I use command interface CMake as follows (with an empty build
> directory):
>
>>  cd test
>>  cmake B --build B\build
>
> CMake Error: The source directory "C:/Arnault/CMT2/test/B/build" does not
> appear to contain CMakeLists.txt.
> Specify --help for usage, or press the help button on the CMake GUI.
>
>
> If I first run cmake-gui, and specify the build directory, it's OK and it
> properly populates the cache.
>
> if now, I redo (command line but with a build directory already populated) :
>
>>  cmake B --build B\build
>
>
>
> it's all ok now!!
>
> Question: How to start a build from scratch, using the command line, and
> specifying a build out-the-source ?
>
> Thanks a lot for your help...
>
> Cheers
> Christian
>
> --
> --------------------------------------------
> | Christian Arnault                        |
> | LAL Bat 200 pièce 03a                    |
> | 91405 Orsay CEDEX                        |
> | phone   : (33) 1 64 46 84 24             |
> | gsm     : (33) 6 77 27 62 30             |
> | fax     : (33) 1 69 07 94 04             |
> | e-mail  : christian.arnault at lal.in2p3.fr |
> --------------------------------------------
>
> --
>
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list