This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new d32cc734b [C++] do not hardcode Unix Makefiles generator (#2745)
d32cc734b is described below

commit d32cc734bd858cd79bb31e1eb5ed00811f84ca77
Author: Mikhail Koviazin <[email protected]>
AuthorDate: Mon Feb 19 11:28:31 2024 +0200

    [C++] do not hardcode Unix Makefiles generator (#2745)
    
    Instead, use `cmake --build`. It has been mentioned at least in cmake
    3.2 documentation [1] which has been released in 2015.
    This will make a build process more flexible to people who want to use
    different build systems such as Ninja.
    
    [1]: https://cmake.org/cmake/help/v3.2/manual/cmake.1.html
    
    (cherry picked from commit c66e8ca4917f99415dc70ec9fa447314567a34da)
---
 lang/c++/build.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lang/c++/build.sh b/lang/c++/build.sh
index ac9964c75..0c7fd6bbc 100755
--- a/lang/c++/build.sh
+++ b/lang/c++/build.sh
@@ -71,10 +71,10 @@ function do_dist() {
   fi
 }
 
-(mkdir -p build; cd build; cmake --version; cmake -G "Unix Makefiles" ..)
 for target in "$@"
 do
 
+cmake -S . -B build
 case "$target" in
   lint)
     # some versions of cppcheck seem to require an explicit
@@ -83,7 +83,7 @@ case "$target" in
     ;;
 
   test)
-    (cd build && cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug -D 
AVRO_ADD_PROTECTOR_FLAGS=1 .. && make && cd .. \
+    (cmake -S. -Bbuild -D CMAKE_BUILD_TYPE=Debug -D AVRO_ADD_PROTECTOR_FLAGS=1 
&& cmake --build build \
       && ./build/buffertest \
       && ./build/unittest \
       && ./build/CodecTests \
@@ -104,7 +104,7 @@ case "$target" in
     ;;
 
   dist)
-    (cd build && cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release ..)
+    (cd build && cmake -D CMAKE_BUILD_TYPE=Release ..)
     do_dist
     do_doc
     ;;
@@ -118,12 +118,12 @@ case "$target" in
     ;;
 
   clean)
-    (cd build && make clean)
+    (cmake --build build --target clean)
     rm -rf doc test.avro test?.df test??.df test_skip.df test_lastSync.df 
test_readRecordUsingLastSync.df
     ;;
 
   install)
-    (cd build && cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release .. && 
make install)
+    (cmake -S. -Bbuild -D CMAKE_BUILD_TYPE=Release && cmake --build build 
--target install)
     ;;
 
   *)

Reply via email to