Creating CMake Assembly Files in the Source Directory

I am very new to CMake. A friend wrote a simple CMakeLists.txt for a project that I code myself. I use svn and just checked the old version on the same computer in a different folder. Now, in the original source directory (where CMakeLists.txt is located), I create a "build" directory in it, cd and run the code for a while

cmake -DCMAKE_BUILD_TYPE=Debug ..

This nicely puts all the files in the assembly directory

-- Build files have been written to: ~/MixedFEMultigrid/build

Now, when I go to another directory, create another "prefabricated" directory in it, and then run the CMake command. I get the following

-- Build files have been written to: ~/oldCode

where oldCode is actually the parent directory. I have no idea why this is happening. Can someone explain this to me? The full CMakeLists.txt file is shown below.

cmake_minimum_required (VERSION 2.6)
project (MixedFEMultigrid)
FIND_PACKAGE(LAPACK REQUIRED)
set( SRC_FILES  multigrid.c 
  gridHandling.c
  interpolation.c
  linApprox.c
  params.c
  sparseMatrix.c
  testing.c
  richardsFunctions.c
  definitions.c
  newtonIteration.c
  )

#Adds the executable with all the dependencies
add_executable (multigrid ${SRC_FILES})

#Specifies the libraries to link to the target
TARGET_LINK_LIBRARIES(multigrid ${LAPACK_LIBRARIES} m)

# Update if necessary
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -fstrict-aliasing -std=c99 -O3")

escrafford , , .

cd ~
mkdir oldCode
cd oldCode
svn co <repository>
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..

"oldCode" "build". , , 'build'

cd ~
mkdir MixedFEMultigrid
cd MixedFEMultigrid
svn co <repository>
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
+4
1

cake-in-source

CMake:

$ rm CMakeCache.txt
$ mkdir debug
$ cd debug
$ cmake -DCMAKE_BUILD_TYPE=Debug ..

, , cmake

$ cd ..
$ rm -rf debug

make clean make distclean

+4

Source: https://habr.com/ru/post/1543477/


All Articles