2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-02-01 08:12:07 +00:00

[CMake] Add test for cmake file

This commit is contained in:
Mike Dev
2019-01-02 15:29:35 +03:00
committed by Andrey Semashev
parent 1dd9dd831b
commit 04ddfdeb19
3 changed files with 61 additions and 2 deletions

View File

@@ -225,6 +225,22 @@ matrix:
env: TOOLSET=clang COMPILER=clang++ CXXSTD64=03,11,14,1z
osx_image: xcode9.4
# cmake self-test
- os: linux
env: TEST_CMAKE=1
addons:
apt:
packages:
- cmake
script:
- mkdir __build_static__ && cd __build_static__
- cmake ../libs/atomic/test/test_cmake
- cmake --build .
- cd ..
- mkdir __build_shared__ && cd __build_shared__
- cmake -DBUILD_SHARED_LIBS=On ../libs/atomic/test/test_cmake
- cmake --build .
install:
- cd ..
@@ -238,8 +254,7 @@ install:
- git submodule update --jobs 4
- cp -r $TRAVIS_BUILD_DIR/* libs/atomic
- python tools/boostdep/depinst/depinst.py atomic
- ./bootstrap.sh
- ./b2 headers
- if [ -n "$TEST_CMAKE" ]; then ./bootstrap.sh; ./b2 headers; fi
script:
- |-

View File

@@ -0,0 +1,22 @@
# Copyright 2018 Mike Dev
# 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
#
# NOTE: This does NOT run the unit tests for Boost.Atomic.
# It only tests, if the CMakeLists.txt file in it's root works as expected
cmake_minimum_required( VERSION 3.5 )
project( BoostAtomicCMakeSelfTest )
add_definitions( -DBOOST_ALL_NO_LIB )
add_subdirectory( ../../../assert ${CMAKE_CURRENT_BINARY_DIR}/libs/assert )
add_subdirectory( ../../../config ${CMAKE_CURRENT_BINARY_DIR}/libs/config )
add_subdirectory( ../../../static_assert ${CMAKE_CURRENT_BINARY_DIR}/libs/static_assert )
add_subdirectory( ../../../type_traits ${CMAKE_CURRENT_BINARY_DIR}/libs/type_traits )
add_subdirectory( ../.. ${CMAKE_CURRENT_BINARY_DIR}/libs/boost_atomic )
add_executable( boost_atomic_cmake_self_test main.cpp )
target_link_libraries( boost_atomic_cmake_self_test Boost::atomic )

22
test/test_cmake/main.cpp Normal file
View File

@@ -0,0 +1,22 @@
// Copyright (c) 2018 Mike Dev
//
// 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)
#include <boost/atomic.hpp>
struct Dummy
{
int x[128];
};
int main()
{
Dummy d = {};
boost::atomic<Dummy> ad;
// this operation requires functions from
// the compiled part of Boost.Atomic
ad = d;
}