diff mbox series

[v3,01/12] cmake: don't "mkdir -p" and "cd" in build instructions

Message ID patch-v3-01.12-028fa1436d8-20221101T225022Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series cmake: document, fix on *nix, add CI | expand

Commit Message

Ævar Arnfjörð Bjarmason Nov. 1, 2022, 10:51 p.m. UTC
Use the "-S" and -B" flags instead of "mkdir -p" and "cd". The "-p"
flag to "mkdir" wasn't needed as "contrib/buildsystems" is tracked,
and the rest of this is now easier to copy/paste into a shell without
having one's directory changed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 contrib/buildsystems/CMakeLists.txt | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Phillip Wood Nov. 3, 2022, 9:37 a.m. UTC | #1
On 01/11/2022 22:51, Ævar Arnfjörð Bjarmason wrote:
> Use the "-S" and -B" flags instead of "mkdir -p" and "cd". The "-p"
> flag to "mkdir" wasn't needed as "contrib/buildsystems" is tracked,
> and the rest of this is now easier to copy/paste into a shell without
> having one's directory changed.

When was "-B" added? This feels like a personal preference rather than 
an objective improvement. Arguably changing into the build directory is 
actually better as ctest has to be run from there. It also appears that 
these instructions have not been tested as the make invocation in wrong.

Best Wishes

Phillip

> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>   contrib/buildsystems/CMakeLists.txt | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 3957e4cf8cd..494da807c53 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -16,9 +16,7 @@ though, therefore the `File>Open>Folder...` option is preferred.
>   
>   Instructions to run CMake manually:
>   
> -    mkdir -p contrib/buildsystems/out
> -    cd contrib/buildsystems/out
> -    cmake ../ -DCMAKE_BUILD_TYPE=Release
> +    cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release
>   
>   This will build the git binaries in contrib/buildsystems/out
>   directory (our top-level .gitignore file knows to ignore contents of
> @@ -36,8 +34,8 @@ NOTE: -DCMAKE_BUILD_TYPE is optional. For multi-config generators like Visual St
>   this option is ignored
>   
>   This process generates a Makefile(Linux/*BSD/MacOS) , Visual Studio solution(Windows) by default.
> -Run `make` to build Git on Linux/*BSD/MacOS.
> -Open git.sln on Windows and build Git.
> +Run `make -C contrib/buildsystems` to build Git on Linux/*BSD/MacOS.
> +Open contrib/buildsystems/git.sln on Windows and build Git.
>   
>   NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studio in Windows,
>   to use another tool say `ninja` add this to the command line when configuring.
diff mbox series

Patch

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3957e4cf8cd..494da807c53 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -16,9 +16,7 @@  though, therefore the `File>Open>Folder...` option is preferred.
 
 Instructions to run CMake manually:
 
-    mkdir -p contrib/buildsystems/out
-    cd contrib/buildsystems/out
-    cmake ../ -DCMAKE_BUILD_TYPE=Release
+    cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release
 
 This will build the git binaries in contrib/buildsystems/out
 directory (our top-level .gitignore file knows to ignore contents of
@@ -36,8 +34,8 @@  NOTE: -DCMAKE_BUILD_TYPE is optional. For multi-config generators like Visual St
 this option is ignored
 
 This process generates a Makefile(Linux/*BSD/MacOS) , Visual Studio solution(Windows) by default.
-Run `make` to build Git on Linux/*BSD/MacOS.
-Open git.sln on Windows and build Git.
+Run `make -C contrib/buildsystems` to build Git on Linux/*BSD/MacOS.
+Open contrib/buildsystems/git.sln on Windows and build Git.
 
 NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studio in Windows,
 to use another tool say `ninja` add this to the command line when configuring.