diff options
author | Roger Leigh <rleigh@debian.org> | 2013-09-08 22:51:43 +0100 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2013-09-29 16:45:34 +0100 |
commit | 4a272b256ea0cae74cad442eca75363e9d8edb47 (patch) | |
tree | 1450526d5688bb52b058db50634cfef0a1f53624 /test/CMakeLists.txt | |
parent | f71acb7a31d7932cf3d5f8aaa1682787c18b2127 (diff) | |
download | schroot-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 'test/CMakeLists.txt')
-rw-r--r-- | test/CMakeLists.txt | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..9a1c324c --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,144 @@ +# 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/>. +# +##################################################################### + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sbuild) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sbuild/chroot) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin-common) + +set(srcdir ${PROJECT_SOURCE_DIR}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup-test-data + ${CMAKE_CURRENT_BINARY_DIR}/setup-test-data) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cleanup-test-data + ${CMAKE_CURRENT_BINARY_DIR}/cleanup-test-data) + +if(BUILD_BLOCKDEV) + set(sbuild_chroot_blockdev_sources + sbuild/chroot/block-device.cc) +endif(BUILD_BLOCKDEV) + +if(BUILD_LOOPBACK) + set(sbuild_chroot_loopback_sources + sbuild/chroot/loopback.cc) +endif(BUILD_LOOPBACK) + +if(BUILD_LVMSNAP) + set(sbuild_chroot_lvmsnap_sources + sbuild/chroot/lvm-snapshot.cc) +endif(BUILD_LVMSNAP) + +if(BUILD_BTRFSSNAP) + set(sbuild_chroot_btrfssnap_sources + sbuild/chroot/btrfs-snapshot.cc) +endif(BUILD_BTRFSSNAP) + +if(BUILD_PERSONALITY) + set(sbuild_personality_sources + sbuild/personality.cc) +endif(BUILD_PERSONALITY) + +set(sbuild_chroot_chroot_sources + sbuild/chroot/chroot.h + sbuild/chroot/chroot.cc + sbuild/chroot/plain.cc + sbuild/chroot/custom.cc + sbuild/chroot/file.cc + sbuild/chroot/directory.cc + ${sbuild_chroot_blockdev_sources} + ${sbuild_chroot_lvmsnap_sources} + ${sbuild_chroot_btrfssnap_sources} + ${sbuild_chroot_loopback_sources} + sbuild/chroot/facet/userdata.cc) + +if (BUILD_TESTS) + add_test(NAME setup-test-data + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/setup-test-data) +endif (BUILD_TESTS) + +if (BUILD_TESTS) + add_executable(sbuild/chroot/chroot ${sbuild_chroot_chroot_sources}) + target_link_libraries(sbuild/chroot/chroot sbuild testmain) + add_test(sbuild/chroot/chroot sbuild/chroot/chroot) +endif (BUILD_TESTS) + +set(sbuild_chroot_config_sources + sbuild/chroot/config.cc) + +if (BUILD_TESTS) + add_executable(sbuild/chroot/config ${sbuild_chroot_config_sources}) + target_link_libraries(sbuild/chroot/config sbuild testmain) + add_test(sbuild/chroot/config sbuild/chroot/config) +endif (BUILD_TESTS) + +set(sbuild_standard_sources + sbuild/environment.cc + sbuild/log.cc + sbuild/nostream.cc + sbuild/parse-value.cc + ${sbuild_personality_sources} + sbuild/regex.cc + sbuild/util.cc) + +if (BUILD_TESTS) + add_executable(sbuild/standard ${sbuild_standard_sources}) + target_link_libraries(sbuild/standard sbuild testmain) + add_test(sbuild/standard sbuild/standard) +endif (BUILD_TESTS) + +set(sbuild_keyfile_sources + sbuild/keyfile.cc) + +if (BUILD_TESTS) + add_executable(sbuild/keyfile ${sbuild_keyfile_sources}) + target_link_libraries(sbuild/keyfile sbuild testmain) + add_test(sbuild/keyfile sbuild/keyfile) +endif (BUILD_TESTS) + +set(sbuild_lock_sources + sbuild/lock.cc) + +if (BUILD_TESTS) + add_executable(sbuild/lock ${sbuild_lock_sources}) + target_link_libraries(sbuild/lock sbuild testmain) + # lock is excluded, because it is timing dependent and can fail + # randomly on slow or heavily-loaded systems. +endif (BUILD_TESTS) + +set(sbuild_run_parts_sources + sbuild/run-parts.cc) + +if (BUILD_TESTS) + add_executable(sbuild/run-parts ${sbuild_run_parts_sources}) + target_link_libraries(sbuild/run-parts sbuild testmain) + add_test(sbuild/run-parts sbuild/run-parts) +endif (BUILD_TESTS) + +set(bin_common_option_action_sources + bin-common/option-action.cc) + +if (BUILD_TESTS) + add_executable(bin-common/option-action ${bin_common_option_action_sources}) + target_link_libraries(bin-common/option-action bin-common testmain) + add_test(bin-common/option-action bin-common/option-action) +endif (BUILD_TESTS) + +if (BUILD_TESTS) + add_test(NAME cleanup-test-data + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/cleanup-test-data) +endif (BUILD_TESTS) |