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

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


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

commit c66e8ca4917f99415dc70ec9fa447314567a34da
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
---
 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 f31c91fef..81530ed0f 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 \
@@ -105,7 +105,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
     ;;
@@ -119,12 +119,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