View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015718CMakeCMakepublic2015-08-28 16:202016-01-04 11:52
Reporterbenben 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
Platformx86-64OSWindowsOS Version7
Product VersionCMake 3.3.1 
Target VersionFixed in Version 
Summary0015718: wrong directory when making an out-of-source build
DescriptionTrying to make an out-of-source build. It should build in the current working directory. But instead, cmake puts everything in the directory in which the root CMakeLists.txt is.

It is not the "subst" Issue from Bug 11153, I dont use subst.
(http://www.cmake.org/Bug/view.php?id=11153 [^])

In the following "Steps To Reproduce" in line 1 the Prompt shows the current directory:
D:\prj\cmake-try\1\_build
But the last line shows that writing was done to:
D:/prj/cmake-try/1

The "Additional Information" shows file-tree before/after.
Steps To ReproduceD:\prj\cmake-try\1\_build>D:/Programme/cmake/bin/cmake.exe -G "MinGW Makefiles" -D"CMAKE_MAKE_PROGRAM:PATH=D:/Programme/mingw/bin/make.exe" ../CMakeLists.txt

-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: D:/Programme/mingw/bin/gcc.exe
-- Check for working C compiler: D:/Programme/mingw/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/Programme/mingw/bin/g++.exe
-- Check for working CXX compiler: D:/Programme/mingw/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/prj/cmake-try/1
Additional Information-- before: --

 Verzeichnis von D:\prj\cmake-try\1

28.08.2015 22:12 <DIR> .
28.08.2015 22:12 <DIR> ..
28.08.2015 21:52 <DIR> _build
28.08.2015 22:12 <DIR> Demo
28.08.2015 22:12 <DIR> Hello
28.08.2015 21:09 502 CMakeLists.txt
               1 Datei(en), 502 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Demo

28.08.2015 22:12 <DIR> .
28.08.2015 22:12 <DIR> ..
28.08.2015 21:12 413 CMakeLists.txt
28.08.2015 21:11 117 demo.cxx
28.08.2015 21:12 62 demo_b.cxx
               3 Datei(en), 592 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Hello

28.08.2015 22:12 <DIR> .
28.08.2015 22:12 <DIR> ..
28.08.2015 21:10 386 CMakeLists.txt
28.08.2015 21:10 56 hello.cxx
               2 Datei(en), 442 Bytes

 Verzeichnis von D:\prj\cmake-try\1\_build

28.08.2015 21:52 <DIR> .
28.08.2015 21:52 <DIR> ..
               0 Datei(en), 0 Bytes

-- after: --

D:\prj\cmake-try\1\_build>dir /s/o ..
 Volume in Laufwerk D: hat keine Bezeichnung.
 Volumeseriennummer: 7032-57BD

 Verzeichnis von D:\prj\cmake-try\1

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 21:52 <DIR> _build
28.08.2015 22:16 <DIR> CMakeFiles
28.08.2015 22:16 <DIR> Demo
28.08.2015 22:16 <DIR> Hello
28.08.2015 22:16 1.484 cmake_install.cmake
28.08.2015 22:16 13.089 CMakeCache.txt
28.08.2015 21:09 502 CMakeLists.txt
28.08.2015 22:16 4.655 Makefile
               4 Datei(en), 19.730 Bytes

 Verzeichnis von D:\prj\cmake-try\1\CMakeFiles

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 <DIR> 3.3.1
28.08.2015 22:16 <DIR> CMakeTmp
28.08.2015 22:16 86 cmake.check_cache
28.08.2015 22:16 628 CMakeDirectoryInformation.cmake
28.08.2015 22:16 34.355 CMakeOutput.log
28.08.2015 22:16 30.949 feature_tests.bin
28.08.2015 22:16 10.414 feature_tests.cxx
28.08.2015 22:16 7.935 Makefile.cmake
28.08.2015 22:16 5.662 Makefile2
28.08.2015 22:16 3 progress.marks
28.08.2015 22:16 97 TargetDirectories.txt
               9 Datei(en), 90.129 Bytes

 Verzeichnis von D:\prj\cmake-try\1\CMakeFiles\3.3.1

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 <DIR> CompilerIdC
28.08.2015 22:16 <DIR> CompilerIdCXX
28.08.2015 22:16 1.845 CMakeCCompiler.cmake
28.08.2015 22:16 3.994 CMakeCXXCompiler.cmake
28.08.2015 22:16 28.925 CMakeDetermineCompilerABI_C.bin
28.08.2015 22:16 28.934 CMakeDetermineCompilerABI_CXX.bin
28.08.2015 22:16 244 CMakeRCCompiler.cmake
28.08.2015 22:16 367 CMakeSystem.cmake
               6 Datei(en), 64.309 Bytes

 Verzeichnis von D:\prj\cmake-try\1\CMakeFiles\3.3.1\CompilerIdC

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 28.996 a.exe
28.08.2015 22:16 15.862 CMakeCCompilerId.c
               2 Datei(en), 44.858 Bytes

 Verzeichnis von D:\prj\cmake-try\1\CMakeFiles\3.3.1\CompilerIdCXX

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 29.024 a.exe
28.08.2015 22:16 15.878 CMakeCXXCompilerId.cpp
               2 Datei(en), 44.902 Bytes

 Verzeichnis von D:\prj\cmake-try\1\CMakeFiles\CMakeTmp

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
               0 Datei(en), 0 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Demo

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 <DIR> CMakeFiles
28.08.2015 22:16 886 cmake_install.cmake
28.08.2015 21:12 413 CMakeLists.txt
28.08.2015 21:11 117 demo.cxx
28.08.2015 21:12 62 demo_b.cxx
28.08.2015 22:16 6.169 Makefile
               5 Datei(en), 7.647 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Demo\CMakeFiles

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 <DIR> helloDemo.dir
28.08.2015 22:16 628 CMakeDirectoryInformation.cmake
28.08.2015 22:16 3 progress.marks
               2 Datei(en), 631 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Demo\CMakeFiles\helloDemo.dir

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 7.124 build.make
28.08.2015 22:16 363 cmake_clean.cmake
28.08.2015 22:16 95 depend.make
28.08.2015 22:16 688 DependInfo.cmake
28.08.2015 22:16 232 flags.make
28.08.2015 22:16 29 includes_CXX.rsp
28.08.2015 22:16 449 link.txt
28.08.2015 22:16 120 linklibs.rsp
28.08.2015 22:16 79 objects1.rsp
28.08.2015 22:16 68 progress.make
              10 Datei(en), 9.247 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Hello

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 <DIR> CMakeFiles
28.08.2015 22:16 887 cmake_install.cmake
28.08.2015 21:10 386 CMakeLists.txt
28.08.2015 21:10 56 hello.cxx
28.08.2015 22:16 5.312 Makefile
               4 Datei(en), 6.641 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Hello\CMakeFiles

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 <DIR> Hello.dir
28.08.2015 22:16 628 CMakeDirectoryInformation.cmake
28.08.2015 22:16 3 progress.marks
               2 Datei(en), 631 Bytes

 Verzeichnis von D:\prj\cmake-try\1\Hello\CMakeFiles\Hello.dir

28.08.2015 22:16 <DIR> .
28.08.2015 22:16 <DIR> ..
28.08.2015 22:16 4.837 build.make
28.08.2015 22:16 255 cmake_clean.cmake
28.08.2015 22:16 40 cmake_clean_target.cmake
28.08.2015 22:16 91 depend.make
28.08.2015 22:16 514 DependInfo.cmake
28.08.2015 22:16 228 flags.make
28.08.2015 22:16 29 includes_CXX.rsp
28.08.2015 22:16 127 link.txt
28.08.2015 22:16 46 progress.make
               9 Datei(en), 6.167 Bytes

 Verzeichnis von D:\prj\cmake-try\1\_build

28.08.2015 21:52 <DIR> .
28.08.2015 21:52 <DIR> ..
               0 Datei(en), 0 Bytes

TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0039345)
benben (reporter)
2015-08-28 16:29

The files/directories example is the one from http://www.cmake.org/examples/ [^]
(0039346)
Brad King (manager)
2015-08-28 16:30

If you have a CMakeCache.txt in your source tree then it is also a build tree and you can't do an out-of-source build. Had you built in-source first?
(0039347)
benben (reporter)
2015-08-28 16:34
edited on: 2015-08-28 16:44

@BradKing

> Had you built in-source first?

No, I tried to have it repeat what is described here: http://www.cmake.org/examples [^]

(0039348)
Brad King (manager)
2015-08-28 16:42

Re 0015718:0039347: No, CMakeCache.txt is generated by CMake at the top of the build tree. Its presence indicates that a directory is a build tree. CMakeCache.txt files hold information that is specific to each build tree so one cannot keep them in the source tree (except in an in-source build).

If you want some cache entries to be populated when you create a new build tree you can either keep a script with -D options or an initial cache file for use with the -C option:

 http://www.cmake.org/cmake/help/v3.3/manual/cmake.1.html [^]

I have rarely ever needed to do this though.

For further help please post to the mailing list:

 http://www.cmake.org/mailman/listinfo/cmake [^]
(0039349)
benben (reporter)
2015-08-28 16:46

Sorry, I copy-pasted the filename from your question. I did *not* have the Cache file in the directory, just CMakeLists.txt (in the Additional Information you can see my file tree). Sorry for the confusion.
(0039350)
benben (reporter)
2015-08-29 00:46
edited on: 2015-08-29 00:52

Sorry but this is *not* resolved, I did not have CMakeCache.txt in the source root, only CMakeLists.txt. The Additional Information contains my file tree. I really appreciate the help, thank you!

(0039351)
benben (reporter)
2015-08-29 00:54

Sorry but this is *not* resolved, I did not have CMakeCache.txt in the source root, only CMakeLists.txt. The Additional Information contains my file tree. I really appreciate the help, thank you!
(0039353)
d3x0r (reporter)
2015-08-29 19:00

Usually you only specify the path to the root of the tree to build not including the /CMakeLists.txt
(0039354)
benben (reporter)
2015-08-30 02:18
edited on: 2015-08-30 02:18

That did the trick! It is now writing the files to the _build directory. Thank you for your help!

For people finding this via search engine: run this in a build-dir which is one level below your source-root:
cmake -G "MinGW Makefiles" -D"CMAKE_MAKE_PROGRAM:PATH=YOURPATHTO/make.exe" ../

(0040131)
Robert Maynard (manager)
2016-01-04 11:52

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-08-28 16:20 benben New Issue
2015-08-28 16:29 benben Note Added: 0039345
2015-08-28 16:30 Brad King Note Added: 0039346
2015-08-28 16:34 benben Note Added: 0039347
2015-08-28 16:42 Brad King Note Added: 0039348
2015-08-28 16:43 Brad King Status new => resolved
2015-08-28 16:43 Brad King Resolution open => no change required
2015-08-28 16:44 benben Note Edited: 0039347
2015-08-28 16:46 benben Note Added: 0039349
2015-08-29 00:46 benben Note Added: 0039350
2015-08-29 00:52 benben Note Edited: 0039350
2015-08-29 00:54 benben Note Added: 0039351
2015-08-29 00:54 benben Status resolved => feedback
2015-08-29 00:54 benben Resolution no change required => reopened
2015-08-29 19:00 d3x0r Note Added: 0039353
2015-08-30 02:18 benben Note Added: 0039354
2015-08-30 02:18 benben Status feedback => new
2015-08-30 02:18 benben Note Edited: 0039354
2015-08-31 13:36 Brad King Status new => resolved
2015-08-31 13:36 Brad King Resolution reopened => no change required
2016-01-04 11:52 Robert Maynard Note Added: 0040131
2016-01-04 11:52 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team