imcs-compsim / MIRCO

A shared-memory parallel BEM code for the contact of rough surfaces
MIT License
2 stars 3 forks source link

Add CMake logic to enforce out-of-source build #60

Closed mayrmt closed 2 years ago

mayrmt commented 2 years ago

Description and Context

We ask for an out-of-source build in our README, though we have not enforced it, yet. This now adds some CMake commands to abort the configure process, if the user attempts to build in the source directory.

Related Issues and Pull Requests

How Has This Been Tested?

I attempted an in-source build on my local machine and ran into the error. The out-of-source build still works just fine.

Checklist

Additional Information

Here's the configure log for an attempted in-source build:

$ ./do-configure 
Source and build directory:
-- Path to source code:     /home/a11bmama/codes/mayrmt_mirco/src-mirco
-- Path to build directory: /home/a11bmama/codes/mayrmt_mirco/src-mirco
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (message):

  In-source builds not allowed.  Please make a new directory (called a build
  directory) and run CMake from there.

  To clean-up, you may need to remove CMakeCache.txt and CMakeFiles from your
  source directory.

-- Configuring incomplete, errors occurred!
See also "/home/a11bmama/codes/mayrmt_mirco/src-mirco/CMakeFiles/CMakeOutput.log".

Interested Parties / Possible Reviewers

@RShaw026 @NoraHagmeyer