set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
+set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build")
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SERVER=TRUE \
+ -DBUILD_UNITTESTS=FALSE \
-DBUILD_CLIENT=FALSE && \
make -j2 && \
make install
BUILD_CLIENT=TRUE - Build Minetest client
BUILD_SERVER=FALSE - Build Minetest server
+ BUILD_UNITTESTS=TRUE - Build unittest sources
CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug)
Release - Release build
Debug - Debug build
${JTHREAD_SRCS}
${common_SCRIPT_SRCS}
${UTIL_SRCS}
- ${UNITTEST_SRCS}
)
+if(BUILD_UNITTESTS)
+ set(common_SRCS ${common_SRCS} ${UNITTEST_SRCS})
+endif()
+
# This gives us the icon and file version information
if(WIN32)
${client_network_SRCS}
${client_irrlicht_changes_SRCS}
${client_SCRIPT_SRCS}
- ${UNITTEST_CLIENT_SRCS}
)
+
+if(BUILD_UNITTESTS)
+ set(client_SRCS ${client_SRCS} ${UNITTEST_CLIENT_SRCS})
+endif()
+
list(SORT client_SRCS)
# Server sources
#cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H
#cmakedefine01 CURSES_HAVE_NCURSESW_NCURSES_H
#cmakedefine01 CURSES_HAVE_NCURSESW_CURSES_H
+#cmakedefine01 BUILD_UNITTESTS
#ifndef __ANDROID__
// Run unit tests
if (cmd_args.getFlag("run-unittests")) {
+#if BUILD_UNITTESTS
return run_tests();
+#else
+ errorstream << "Unittest support is not enabled in this binary. "
+ << "If you want to enable it, compile project with BUILD_UNITTESTS=1 flag."
+ << std::endl;
+#endif
}
#endif