]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Fix insource builds
authorMatthias Maier <tamiko@43-1.org>
Mon, 11 Jun 2018 15:54:55 +0000 (10:54 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 11 Jun 2018 15:54:55 +0000 (10:54 -0500)
In case of an in-source build (which we officially support)
CMAKE_BINARY_DIR==CMAKE_SOURCE_DIR. With that, the boost test fails (by
brutally removing its own source directory...)

Fix this by using a different name for the working directory

cmake/configure/configure_2_boost.cmake

index dfba61dc75e16a5425815dfe8540a1c461d67658..799a8287bd8cb13e0bb95a40dbf63faed5f689a8 100644 (file)
@@ -169,8 +169,10 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
         # Only run this check if it hasn't successfully run previously.
         MESSAGE(STATUS "Performing Test BOOST_SERIALIZATION_USABLE")
 
-        FILE(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug)
-        FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug)
+        SET(_binary_test_dir ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBugWorkdir)
+
+        FILE(REMOVE_RECURSE ${_binary_test_dir})
+        FILE(MAKE_DIRECTORY ${_binary_test_dir})
         EXECUTE_PROCESS(
           COMMAND ${CMAKE_COMMAND}
             -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@@ -181,7 +183,7 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
             "-DBOOST_INCLUDE_DIRS=${BOOST_INCLUDE_DIRS}"
             "-DBOOST_LIBRARIES=${BOOST_LIBRARIES}"
             ${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure/TestBoostBug
-          WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug
+          WORKING_DIRECTORY ${_binary_test_dir}
           RESULT_VARIABLE _result
           OUTPUT_QUIET
           ERROR_QUIET
@@ -189,7 +191,7 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
         IF(${_result} EQUAL 0)
           EXECUTE_PROCESS(
             COMMAND ${CMAKE_COMMAND} --build . --target run
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug
+            WORKING_DIRECTORY ${_binary_test_dir}
             RESULT_VARIABLE _result
             OUTPUT_QUIET
             ERROR_QUIET
@@ -209,8 +211,8 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
           "The externally provided Boost.Serialization library "
           "failed to pass a crucial test. \n"
           "Therefore, the bundled boost package is used. \n"
-          "The configured testing project can be found at "
-          "${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/TestBoostBug"
+          "The configured testing project can be found at \n"
+          "${_binary_test_dir}"
           )
         SET(BOOST_ADDITIONAL_ERROR_STRING
           "The externally provided Boost.Serialization library "

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.