View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014818CMakeCMakepublic2014-03-20 03:282016-06-10 14:31
ReporterDaniel Hasemann 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86_64OSKubuntuOS Version10.04
Product VersionCMake 2.8.9 
Target VersionFixed in Version 
Summary0014818: Out-of-source build does not work if an 'in-source' CMakeCache.txt file is available
DescriptionI had the following problem: My CMake builds are in-source-builds at the moment and I am refactoring it to out-of-source builds. Because of old 'in-source' CMakeCache file, the out-of-source build does not work as long as this is available.
IMHO the out-of-source build must not depend on in-source CMakeCache.txt
Steps To Reproducecd src
ls
# foo.c bar.c CMakeCache.txt CMakeLists.txt build/ [...]
rm -rf build
mkdir build
cd build
cmake ..

nothing does happen because of ../CMakeCache.txt
TagsNo tags attached.
Attached Files

 Relationships
related to 0006672closedKitware Robot Detect In-Source build BEFORE creating CMakeCache.txt 

  Notes
(0035442)
Eric NOULARD (developer)
2014-03-20 03:45

Hi Daniel,

Have a look at related bug 0006672 you'll see this is a long-running well-known issue.
(0035443)
Eric NOULARD (developer)
2014-03-20 03:49

The reason is stated in cmake command line help:

$ cmake --help
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>


in order to support

cmake [options] <path-to-existing-build>

in a backward compatible way the behavior you observe should be kept.
CMake consider the source dir as an existing build dir precisely because
there is a CMakeCache.txt ini it.
(0035455)
Daniel Hasemann (reporter)
2014-03-20 10:52

Ok, backwards compatibility is one of the most important things. Is it possible to force out-of-source builds or to deny in-source builds with a cmake option or an environment variable?
(0035473)
Ben Boeckel (developer)
2014-03-21 13:59

There is 'if ("${ParaView_SOURCE_DIR}" STREQUAL "${ParaView_BINARY_DIR}")' that ParaView does to detect and error if so, but that won't get you anywhere. The CMakeCache.txt needs to be moved out of the way for CMake to continue with the out-of-source build (since by the time you detect the error, the build directory has already been determined).
(0042511)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2014-03-20 03:28 Daniel Hasemann New Issue
2014-03-20 03:44 Eric NOULARD Relationship added related to 0006672
2014-03-20 03:45 Eric NOULARD Note Added: 0035442
2014-03-20 03:49 Eric NOULARD Note Added: 0035443
2014-03-20 10:52 Daniel Hasemann Note Added: 0035455
2014-03-21 13:59 Ben Boeckel Note Added: 0035473
2016-06-10 14:29 Kitware Robot Note Added: 0042511
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team