Skip to content

Commit

Permalink
[C++] do not hardcode Unix Makefiles generator (#2745)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mkmkme committed Feb 19, 2024
1 parent efbfdcf commit c66e8ca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lang/c++/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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
;;
Expand All @@ -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)
;;

*)
Expand Down

0 comments on commit c66e8ca

Please sign in to comment.