summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2013-09-08 22:51:43 +0100
committerRoger Leigh <rleigh@debian.org>2013-09-29 16:45:34 +0100
commit4a272b256ea0cae74cad442eca75363e9d8edb47 (patch)
tree1450526d5688bb52b058db50634cfef0a1f53624 /lib
parentf71acb7a31d7932cf3d5f8aaa1682787c18b2127 (diff)
downloadschroot-4a272b256ea0cae74cad442eca75363e9d8edb47.tar.gz
build: Add cmake build infrastructure
This permits building using cmake rather than the existing autoconf/automake/libtool infrastructure. The autotools- based build may be removed in future commits, but either may be used until that point.
Diffstat (limited to 'lib')
-rw-r--r--lib/bin-common/CMakeLists.txt29
-rw-r--r--lib/bin-common/run.h2
-rw-r--r--lib/dchroot-common/CMakeLists.txt27
-rw-r--r--lib/sbuild/CMakeLists.txt252
-rw-r--r--lib/sbuild/config.h.cmake96
-rw-r--r--lib/sbuild/config.h.in9
-rw-r--r--lib/sbuild/i18n.h8
-rw-r--r--lib/sbuild/sbuild.pc.cmake10
-rw-r--r--lib/sbuild/session.cc10
-rw-r--r--lib/schroot-common/CMakeLists.txt26
-rw-r--r--lib/test/CMakeLists.txt25
11 files changed, 486 insertions, 8 deletions
diff --git a/lib/bin-common/CMakeLists.txt b/lib/bin-common/CMakeLists.txt
new file mode 100644
index 00000000..307cb81a
--- /dev/null
+++ b/lib/bin-common/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright © 2004-2013 Roger Leigh <rleigh@debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set(bin_common_sources
+ main.h
+ main.cc
+ option-action.h
+ option-action.cc
+ options.h
+ options.cc
+ run.h)
+
+add_library(bin-common STATIC ${bin_common_sources})
+target_link_libraries(bin-common ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE})
diff --git a/lib/bin-common/run.h b/lib/bin-common/run.h
index f8e4413f..2bb97621 100644
--- a/lib/bin-common/run.h
+++ b/lib/bin-common/run.h
@@ -63,7 +63,7 @@ namespace bin_common
std::cout.imbue(std::locale());
std::cerr.imbue(std::locale());
- bindtextdomain (SBUILD_MESSAGE_CATALOGUE, LOCALEDIR);
+ bindtextdomain (SBUILD_MESSAGE_CATALOGUE, SCHROOT_LOCALE_DIR);
textdomain (SBUILD_MESSAGE_CATALOGUE);
typename options_type::ptr opts(new options_type);
diff --git a/lib/dchroot-common/CMakeLists.txt b/lib/dchroot-common/CMakeLists.txt
new file mode 100644
index 00000000..3cac2a43
--- /dev/null
+++ b/lib/dchroot-common/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Copyright © 2004-2013 Roger Leigh <rleigh@debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set(dchroot_common_sources
+ main.h
+ main.cc
+ session.h
+ session.cc)
+
+if (BUILD_LIBDCHROOT)
+ add_library(dchroot-common STATIC ${dchroot_common_sources})
+endif (BUILD_LIBDCHROOT)
diff --git a/lib/sbuild/CMakeLists.txt b/lib/sbuild/CMakeLists.txt
new file mode 100644
index 00000000..bb2dcc22
--- /dev/null
+++ b/lib/sbuild/CMakeLists.txt
@@ -0,0 +1,252 @@
+# Copyright © 2004-2013 Roger Leigh <rleigh@debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sbuild.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/sbuild.pc @ONLY)
+
+set(public_generated_h_sources
+ config.h)
+
+if(BUILD_PAM)
+ set(public_auth_pam_h_sources
+ auth/pam-conv.h
+ auth/pam-conv-tty.h
+ auth/pam.h
+ auth/pam-message.h)
+ set(public_auth_pam_cc_sources
+ auth/pam-conv.cc
+ auth/pam-conv-tty.cc
+ auth/pam.cc
+ auth/pam-message.cc)
+endif(BUILD_PAM)
+
+if(BUILD_PERSONALITY)
+ set(public_personality_facet_h_sources
+ chroot/facet/personality.h)
+ set(public_personality_facet_cc_sources
+ chroot/facet/personality.cc)
+ set(public_personality_h_sources
+ personality.h)
+ set(public_personality_cc_sources
+ personality.cc)
+endif(BUILD_PERSONALITY)
+
+if(BUILD_BLOCKDEV)
+ set(public_blockdev_base_h_sources
+ chroot/facet/block-device-base.h)
+ set(public_blockdev_base_cc_sources
+ chroot/facet/block-device-base.cc)
+ set(public_blockdev_h_sources
+ chroot/facet/block-device.h)
+ set(public_blockdev_cc_sources
+ chroot/facet/block-device.cc)
+endif(BUILD_BLOCKDEV)
+
+if(BUILD_LVMSNAP)
+ set(public_blockdev_base_h_sources
+ chroot/facet/block-device-base.h)
+ set(public_blockdev_base_cc_sources
+ chroot/facet/block-device-base.cc)
+ set(public_lvmsnap_h_sources
+ chroot/facet/lvm-snapshot.h)
+ set(public_lvmsnap_cc_sources
+ chroot/facet/lvm-snapshot.cc)
+endif(BUILD_LVMSNAP)
+
+if(BUILD_BTRFSSNAP)
+ set(public_btrfssnap_h_sources
+ chroot/facet/btrfs-snapshot.h)
+ set(public_btrfssnap_cc_sources
+ chroot/facet/btrfs-snapshot.cc)
+endif(BUILD_BTRFSSNAP)
+
+if(BUILD_LOOPBACK)
+ set(public_loopback_h_sources
+ chroot/facet/loopback.h)
+ set(public_loopback_cc_sources
+ chroot/facet/loopback.cc)
+endif(BUILD_LOOPBACK)
+
+if(BUILD_UNION)
+ set(public_union_h_sources
+ chroot/facet/fsunion.h)
+ set(public_union_cc_sources
+ chroot/facet/fsunion.cc)
+endif(BUILD_UNION)
+
+if(BUILD_UNSHARE)
+ set(public_unshare_h_sources
+ chroot/facet/unshare.h)
+ set(public_unshare_cc_sources
+ chroot/facet/unshare.cc)
+endif(BUILD_UNSHARE)
+
+set(public_h_sources
+ ctty.h
+ custom-error.h
+ environment.h
+ error.h
+ error.tcc
+ fdstream.h
+ feature.h
+ format-detail.h
+ i18n.h
+ keyfile.h
+ keyfile-reader.h
+ keyfile-writer.h
+ lock.h
+ log.h
+ mntstream.h
+ nostream.h
+ parse-error.h
+ parse-value.h
+ regex.h
+ run-parts.h
+ session.h
+ types.h
+ util.h
+ ${public_personality_h_sources})
+
+set(public_cc_sources
+ ctty.cc
+ environment.cc
+ feature.cc
+ format-detail.cc
+ keyfile.cc
+ keyfile-reader.cc
+ keyfile-writer.cc
+ lock.cc
+ log.cc
+ mntstream.cc
+ nostream.cc
+ parse-value.cc
+ run-parts.cc
+ session.cc
+ types.cc
+ util.cc
+ ${public_personality_cc_sources})
+
+set(public_auth_h_sources
+ auth/auth.h
+ auth/deny.h
+ ${public_auth_pam_h_sources})
+
+set(public_auth_cc_sources
+ auth/auth.cc
+ auth/deny.cc
+ ${public_auth_pam_cc_sources})
+
+set(public_chroot_h_sources
+ chroot/chroot.h
+ chroot/config.h)
+
+set(public_chroot_cc_sources
+ chroot/chroot.cc
+ chroot/config.cc)
+
+set(public_chroot_facet_h_sources
+ chroot/facet/custom.h
+ chroot/facet/directory.h
+ chroot/facet/directory-base.h
+ chroot/facet/facet.h
+ chroot/facet/factory.h
+ chroot/facet/file.h
+ chroot/facet/mountable.h
+ chroot/facet/plain.h
+ chroot/facet/session.h
+ chroot/facet/session-clonable.h
+ chroot/facet/session-setup.h
+ chroot/facet/source.h
+ chroot/facet/source-clonable.h
+ chroot/facet/source-setup.h
+ chroot/facet/storage.h
+ chroot/facet/userdata.h
+ ${public_blockdev_base_h_sources}
+ ${public_blockdev_h_sources}
+ ${public_lvmsnap_h_sources}
+ ${public_btrfssnap_h_sources}
+ ${public_loopback_h_sources}
+ ${public_personality_facet_h_sources}
+ ${public_union_h_sources}
+ ${public_unshare_h_sources})
+
+set(public_chroot_facet_cc_sources
+ chroot/facet/custom.cc
+ chroot/facet/directory.cc
+ chroot/facet/directory-base.cc
+ chroot/facet/facet.cc
+ chroot/facet/factory.cc
+ chroot/facet/file.cc
+ chroot/facet/mountable.cc
+ chroot/facet/plain.cc
+ chroot/facet/session.cc
+ chroot/facet/session-clonable.cc
+ chroot/facet/session-setup.cc
+ chroot/facet/source.cc
+ chroot/facet/source-clonable.cc
+ chroot/facet/source-setup.cc
+ chroot/facet/storage.cc
+ chroot/facet/userdata.cc
+ ${public_blockdev_base_cc_sources}
+ ${public_blockdev_cc_sources}
+ ${public_lvmsnap_cc_sources}
+ ${public_btrfssnap_cc_sources}
+ ${public_loopback_cc_sources}
+ ${public_personality_facet_cc_sources}
+ ${public_union_cc_sources}
+ ${public_unshare_cc_sources})
+
+add_library(sbuild SHARED
+ ${public_h_sources}
+ ${public_cc_sources}
+ ${public_auth_h_sources}
+ ${public_auth_cc_sources}
+ ${public_chroot_h_sources}
+ ${public_chroot_cc_sources}
+ ${public_chroot_facet_h_sources}
+ ${public_chroot_facet_cc_sources})
+target_link_libraries(sbuild
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${PAM_LIBRARY}
+ ${REGEX_LIBRARY}
+ ${Boost_IOSTREAMS_LIBRARY_RELEASE}
+ ${Boost_FILESYSTEM_LIBRARY_RELEASE}
+ ${Boost_SYSTEM_LIBRARY_RELEASE})
+set_target_properties(sbuild PROPERTIES VERSION ${GIT_RELEASE_VERSION})
+
+set(pkgincludedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}/sbuild")
+set(pkgincludeauthdir "${CMAKE_INSTALL_FULL_INCLUDEDIR}/sbuild/auth")
+set(pkgincludechrootdir "${CMAKE_INSTALL_FULL_INCLUDEDIR}/sbuild/chroot")
+set(pkgincludechrootfacetdir "${CMAKE_INSTALL_FULL_INCLUDEDIR}/sbuild/chroot/facet")
+set(pkgconfigdatadir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
+
+install(FILES ${public_h_sources}
+ DESTINATION ${pkgincludedir})
+install(FILES ${public_auth_h_sources}
+ DESTINATION ${pkgincludeauthdir})
+install(FILES ${public_chroot_h_sources}
+ DESTINATION ${pkgincludechrootdir})
+install(FILES ${public_chroot_facet_h_sources}
+ DESTINATION ${pkgincludechrootfacetdir})
+
+install(TARGETS sbuild LIBRARY
+ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
+
+set(pkgconfig_files "${CMAKE_CURRENT_BINARY_DIR}/sbuild.pc")
+install(FILES ${pkgconfig_files}
+ DESTINATION ${pkgconfigdatadir})
diff --git a/lib/sbuild/config.h.cmake b/lib/sbuild/config.h.cmake
new file mode 100644
index 00000000..9590cb1f
--- /dev/null
+++ b/lib/sbuild/config.h.cmake
@@ -0,0 +1,96 @@
+/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
+ *
+ *
+ * schroot is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * schroot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *********************************************************************/
+
+#ifndef SBUILD_CONFIG_H
+#define SBUILD_CONFIG_H
+
+/* This header contains configuration macros which determine the
+ correct library to use. This depends upon the libraries found at
+ configure time. */
+
+/* Set if NLS support is available */
+#cmakedefine SBUILD_FEATURE_NLS 1
+
+/* Set if PAM support is available */
+#cmakedefine SBUILD_FEATURE_PAM 1
+
+/* Set if personality support is present */
+#cmakedefine SBUILD_FEATURE_PERSONALITY 1
+
+/* Set if the block-device chroot type is present */
+#cmakedefine SBUILD_FEATURE_BLOCKDEV 1
+
+/* Set if the btrfs-snapshot chroot type is present */
+#cmakedefine SBUILD_FEATURE_BTRFSSNAP 1
+
+/* Set if the lvm-snapshot chroot type is present */
+#cmakedefine SBUILD_FEATURE_LVMSNAP 1
+
+/* Set if the loopback chroot type is present */
+#cmakedefine SBUILD_FEATURE_LOOPBACK 1
+
+/* Set if the union filesystem type is present */
+#cmakedefine SBUILD_FEATURE_UNION 1
+
+/* Define to 1 if you have the <boost/format.hpp> header file. */
+#cmakedefine HAVE_BOOST_FORMAT_HPP 1
+
+/* Define to 1 if you have the <boost/program_options.hpp> header file. */
+#cmakedefine HAVE_BOOST_PROGRAM_OPTIONS_HPP 1
+
+/* Define to 1 if you have the <memory> header file. */
+#cmakedefine HAVE_MEMORY 1
+
+/* Define to 1 if you have the <tuple> header file. */
+#cmakedefine HAVE_TUPLE 1
+
+/* Define to 1 if you have the <regex> header file and std::regex. */
+#cmakedefine HAVE_REGEX_REGEX 1
+
+/* Default regular expression used to filter user environment */
+#cmakedefine SBUILD_DEFAULT_ENVIRONMENT_FILTER "${SBUILD_DEFAULT_ENVIRONMENT_FILTER}"
+
+/* Filesystem locations */
+#cmakedefine SCHROOT_LIBEXEC_DIR "${SCHROOT_LIBEXEC_DIR}"
+#cmakedefine SCHROOT_MOUNT_DIR "${SCHROOT_MOUNT_DIR}"
+#cmakedefine SCHROOT_SESSION_DIR "${SCHROOT_SESSION_DIR}"
+#cmakedefine SCHROOT_FILE_UNPACK_DIR "${SCHROOT_FILE_UNPACK_DIR}"
+#cmakedefine SCHROOT_OVERLAY_DIR "${SCHROOT_OVERLAY_DIR}"
+#cmakedefine SCHROOT_UNDERLAY_DIR "${SCHROOT_UNDERLAY_DIR}"
+#cmakedefine SCHROOT_SYSCONF_DIR "${SCHROOT_SYSCONF_DIR}"
+#cmakedefine SCHROOT_CONF "${SCHROOT_CONF}"
+#cmakedefine SCHROOT_CONF_CHROOT_D "${SCHROOT_CONF_CHROOT_D}"
+#cmakedefine SCHROOT_CONF_SETUP_D "${SCHROOT_CONF_SETUP_D}"
+#cmakedefine SCHROOT_SETUP_DATA_DIR "${SCHROOT_SETUP_DATA_DIR}"
+#cmakedefine SCHROOT_LOCALE_DIR "${SCHROOT_LOCALE_DIR}"
+// TODO: Remove when autotools are removed and sources updated.
+#define PACKAGE_LOCALE_DIR SCHROOT_LOCALE_DIR
+#cmakedefine SCHROOT_DATA_DIR "${SCHROOT_DATA_DIR}"
+#cmakedefine SCHROOT_MODULE_DIR "${SCHROOT_MODULE_DIR}"
+
+/* Translation catalogue name */
+#define SBUILD_MESSAGE_CATALOGUE "schroot"
+
+#endif /* SBUILD_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/lib/sbuild/config.h.in b/lib/sbuild/config.h.in
index 21a1efe6..d4fdbe70 100644
--- a/lib/sbuild/config.h.in
+++ b/lib/sbuild/config.h.in
@@ -24,6 +24,9 @@
correct library to use. This depends upon the libraries found at
configure time. */
+/* Set if NLS support is available */
+#undef SBUILD_FEATURE_NLS
+
/* Set if PAM support is available */
#undef SBUILD_FEATURE_PAM
@@ -54,12 +57,6 @@
/* Define to 1 if you have the <memory> header file. */
#undef HAVE_MEMORY
-/* Define to 1 if you have the <tr1/memory> header file. */
-#undef HAVE_TR1_MEMORY
-
-/* Define to 1 if you have the <tr1/tuple> header file. */
-#undef HAVE_TR1_TUPLE
-
/* Define to 1 if you have the <tuple> header file. */
#undef HAVE_TUPLE
diff --git a/lib/sbuild/i18n.h b/lib/sbuild/i18n.h
index a9fa9894..c773542a 100644
--- a/lib/sbuild/i18n.h
+++ b/lib/sbuild/i18n.h
@@ -28,7 +28,9 @@
#include <string>
-#include <libintl.h>
+#ifdef SBUILD_FEATURE_NLS
+# include <libintl.h>
+#endif // SBUILD_FEATURE_NLS
// Undefine macros which would interfere with our functions.
#ifdef gettext
@@ -55,7 +57,11 @@ namespace sbuild
inline const char *
gettext (const char *message)
{
+#ifdef SBUILD_FEATURE_NLS
return dgettext (SBUILD_MESSAGE_CATALOGUE, message);
+#else
+ return message;
+#endif // SBUILD_FEATURE_NLS
}
/**
diff --git a/lib/sbuild/sbuild.pc.cmake b/lib/sbuild/sbuild.pc.cmake
new file mode 100644
index 00000000..5d8da6f9
--- /dev/null
+++ b/lib/sbuild/sbuild.pc.cmake
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+
+Name: Sbuild
+Description: Debian Source Builder
+Version: ${GIT_RELEASE_VERSION}
+Libs: -L${libdir} -lsbuild
+Cflags: -I${includedir}
diff --git a/lib/sbuild/session.cc b/lib/sbuild/session.cc
index 93c1b1ee..b4875b00 100644
--- a/lib/sbuild/session.cc
+++ b/lib/sbuild/session.cc
@@ -1171,11 +1171,21 @@ namespace sbuild
env.add("DATA_DIR", SCHROOT_DATA_DIR);
env.add("SETUP_DATA_DIR", SCHROOT_SETUP_DATA_DIR);
env.add("PID", getpid());
+#ifdef SBUILD_HOST
env.add("HOST", SBUILD_HOST);
+#endif // SBUILD_HOST
+#ifdef SBUILD_HOST_OS
env.add("HOST_OS", SBUILD_HOST_OS);
+#endif // SBUILD_HOST_OS
+#ifdef SBUILD_HOST_VENDOR
env.add("HOST_VENDOR", SBUILD_HOST_VENDOR);
+#endif // SBUILD_HOST_VENDOR
+#ifdef SBUILD_HOST_CPU
env.add("HOST_CPU", SBUILD_HOST_CPU);
+#endif // SBUILD_HOST_CPU
+#ifdef SBUILD_PLATFORM
env.add("PLATFORM", SBUILD_PLATFORM);
+#endif // SBUILD_PLATFORM
env.add("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
diff --git a/lib/schroot-common/CMakeLists.txt b/lib/schroot-common/CMakeLists.txt
new file mode 100644
index 00000000..9419de3a
--- /dev/null
+++ b/lib/schroot-common/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright © 2004-2013 Roger Leigh <rleigh@debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set(schroot_common_sources
+ options.h
+ options.cc
+ main.h
+ main.cc)
+
+add_library(schroot-common STATIC ${schroot_common_sources})
+target_link_libraries(schroot-common bin-common)
diff --git a/lib/test/CMakeLists.txt b/lib/test/CMakeLists.txt
new file mode 100644
index 00000000..b8a5c17a
--- /dev/null
+++ b/lib/test/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright © 2004-2013 Roger Leigh <rleigh@debian.org>
+#
+# schroot is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# schroot is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+#####################################################################
+
+set(test_sources
+ testmain.cc)
+
+if (BUILD_TESTS)
+ add_library(testmain STATIC ${test_sources})
+ target_link_libraries(testmain sbuild ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+endif (BUILD_TESTS)