Skip to content

Commit

Permalink
GHA: Add CMake subdir test
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire authored and jeking3 committed Nov 26, 2024
1 parent 8ad7522 commit 3347ea3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/cmake_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2021-2024 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.16)

project(cmake_subdir_test LANGUAGES CXX)

# Those 2 should work the same
# while using find_package for the installed Boost avoids the need to manually specify dependencies
if(BOOST_CI_INSTALL_TEST)
find_package(boost_dynamic_bitset REQUIRED)
else()
set(BOOST_INCLUDE_LIBRARIES dynamic_bitset)
add_subdirectory(../../../.. deps/boost EXCLUDE_FROM_ALL)
endif()

add_executable(main main.cpp)
target_link_libraries(main Boost::dynamic_bitset)

enable_testing()
add_test(NAME main COMMAND main)
8 changes: 8 additions & 0 deletions test/cmake_test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <boost/dynamic_bitset.hpp>

int main()
{
const boost::dynamic_bitset<> db{3, 4};

return db[2] ? 0 : 1;
}

0 comments on commit 3347ea3

Please sign in to comment.