Skip to content

Commit

Permalink
Add cmake_install_test, cmake_subdir_test
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Oct 8, 2024
1 parent 495a767 commit 907541a
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/cmake_install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018, 2019 Peter Dimov
# 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_install_test LANGUAGES CXX)

find_package(boost_signals2 REQUIRED)

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

enable_testing()
add_test(main main)

add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
19 changes: 19 additions & 0 deletions test/cmake_install_test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/signals2.hpp>

int f()
{
return 4;
}

int main()
{
boost::signals2::signal<int()> sig;

sig.connect( f );

return sig() == 4? 0: 1;
}
67 changes: 67 additions & 0 deletions test/cmake_subdir_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2018, 2019 Peter Dimov
# 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.20)

project(cmake_subdir_test LANGUAGES CXX)

add_subdirectory(../.. boostorg/signals2)

# boostdep --brief signals2

set(deps

# Primary dependencies

assert
bind
config
core
function
iterator
move
mpl
optional
parameter
preprocessor
smart_ptr
throw_exception
tuple
type_traits
variant

# Secondary dependencies

static_assert
concept_check
detail
function_types
fusion
utility
predef
mp11
container_hash
integer
type_index
describe
functional
typeof
io
)

foreach(dep IN LISTS deps)

add_subdirectory(../../../${dep} boostorg/${dep})

endforeach()

# --target check

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

enable_testing()
add_test(main main)

add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
19 changes: 19 additions & 0 deletions test/cmake_subdir_test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/signals2.hpp>

int f()
{
return 4;
}

int main()
{
boost::signals2::signal<int()> sig;

sig.connect( f );

return sig() == 4? 0: 1;
}

0 comments on commit 907541a

Please sign in to comment.