diff options
author | Javier Jardón <jjardon@gnome.org> | 2017-12-03 23:14:14 +0000 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2017-12-05 14:19:38 +0000 |
commit | dd0d200d370211b18da7978c34962d9b71970b7a (patch) | |
tree | 29faa1ec6bfe930535f927e0a57f42f3c36c3718 | |
parent | fc96ff00bd4d4afe275c215e372bc5c93133fc0e (diff) | |
download | buildstream-dd0d200d370211b18da7978c34962d9b71970b7a.tar.gz |
buildstream/plugins/elements/cmake.yaml: Always create build folderjjardon/cmake_build
This is the common practice with cmake
Actually, some modules will fail to build if this is not follow. For
example for llvm you wil get this error when configuring:
"
CMake would overwrite the makefiles distributed with LLVM.
Please create a directory and run cmake from there, passing the path
to this source directory as the last argument.
"
-rw-r--r-- | buildstream/plugins/elements/cmake.yaml | 8 | ||||
-rw-r--r-- | tests/variables/variables.py | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/buildstream/plugins/elements/cmake.yaml b/buildstream/plugins/elements/cmake.yaml index 2ff0db16d..1a3191e24 100644 --- a/buildstream/plugins/elements/cmake.yaml +++ b/buildstream/plugins/elements/cmake.yaml @@ -2,6 +2,8 @@ variables: + build-dir: _builddir + # FIXME: Get a more complete cmake invocation cmake-extra: '' cmake-global: '' @@ -13,10 +15,10 @@ variables: cmake: | - cmake %{cmake-args} + cmake -B%{build-dir} -H. %{cmake-args} - make: make - make-install: make -j1 DESTDIR="%{install-root}" install + make: make -C %{build-dir} + make-install: make -j1 -C %{build-dir} DESTDIR="%{install-root}" install # Set this if the sources cannot handle parallelization. # diff --git a/tests/variables/variables.py b/tests/variables/variables.py index 954298286..47b1ff9c9 100644 --- a/tests/variables/variables.py +++ b/tests/variables/variables.py @@ -45,7 +45,7 @@ def assert_command(datafiles, tmpdir, target, command, expected): @pytest.mark.parametrize("target,command,expected", [ ('autotools.bst', 'install-commands', "make -j1 DESTDIR=\"/buildstream/install\" install"), ('cmake.bst', 'configure-commands', - "cmake -DCMAKE_INSTALL_PREFIX:PATH=\"/usr\" \\\n" + + "cmake -B_builddir -H. -DCMAKE_INSTALL_PREFIX:PATH=\"/usr\" \\\n" + "-DCMAKE_INSTALL_LIBDIR=lib"), ('distutils.bst', 'install-commands', "python3 setup.py install --prefix \"/usr\" \\\n" + @@ -66,7 +66,7 @@ def test_defaults(datafiles, tmpdir, target, command, expected): @pytest.mark.parametrize("target,command,expected", [ ('autotools.bst', 'install-commands', "make -j1 DESTDIR=\"/custom/install/root\" install"), ('cmake.bst', 'configure-commands', - "cmake -DCMAKE_INSTALL_PREFIX:PATH=\"/opt\" \\\n" + + "cmake -B_builddir -H. -DCMAKE_INSTALL_PREFIX:PATH=\"/opt\" \\\n" + "-DCMAKE_INSTALL_LIBDIR=lib"), ('distutils.bst', 'install-commands', "python3 setup.py install --prefix \"/opt\" \\\n" + |