I tried to compile a project with cmake, but I got the following error :

mostafa@ubuntu:~/oooark$ cmake .
CMake Error at CMakeLists.txt:19 (message):
  In-source builds are not allowed.  

For example run:

rm CMakeCache.txt
mkdir build
cd build
cmake ..
make
-- Configuring incomplete, errors occurred!

Can anyone help me ?

share|improve this question
    
Are you sure make has been installed? Check if both make and gcc is correctly installed.. – Sen Jan 12 '11 at 13:21
    
Could you show us CMakeLists.txt at line 19? – tibur Jan 12 '11 at 13:22
    
So, why don't you read the error message and do what it says? – user562374 Jan 12 '11 at 13:27
    
What i understood is CMake uses a file called CmakeLists.txt - Input text files that contain the project parameters and describe the flow control of the build process in simple CMake language.` So please check with your CmakeLists.txt.. – Sen Jan 12 '11 at 13:32

Previous build has created CMakeCache.txt and a directory CMakeFiles. Remove this file and and directory as:

llvm_src is your root directory where llvm is unzipped or downloaded

$ cd <llvm_src>
$ cd <llvm_src> 
$ rm -rf CMakeCace.txt CMakeFiles
$ mkdir build
$ cd build
$ cmake -G "Unix Makefiles" <llvm_src>

That should generate makefiles in build directory.

$ cmake -DCMAKE_INSTALL_PREFIX:PATH=<path_to_install_directory> . && make all install
share|improve this answer

Do as the help message says: remove the CMakeCache.txt file, create a subdirectory called build, change into that directory, then re-run cmake from there.

rm CMakeCache.txt
mkdir build
cd build
cmake ..
make

This is because you ran "cmake ." in the top of the source tree. The reason for preventing you running cmake in the source directory is to prevent the source tree getting build artefacts spewed all over it.

share|improve this answer
    
Good answer. Could you please explain more? What are these "build artifacts"? So the directory structure should have build, lib, bin folders within it? And we build cmake into the empty build folder? The generated build files are written in build folder. These are the output files. – Nik-Lz Aug 2 '17 at 9:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.