Skip to content

Commit

Permalink
cmake: directly define project version (#1199)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Dimov <[email protected]>
  • Loading branch information
lucascolley and pdimov authored Sep 16, 2024
1 parent 885fd95 commit ff72eaa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

cmake_minimum_required(VERSION 3.5...3.16)

project(boost_math VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
project(boost_math VERSION 1.87.0 LANGUAGES CXX)

add_library(boost_math INTERFACE)

Expand Down
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)

if(HAVE_BOOST_TEST)

boost_test(SOURCES check_cmake_version.cpp ARGUMENTS ${PROJECT_VERSION} LINK_LIBRARIES Boost::core Boost::config)

if (BOOST_MATH_ENABLE_CUDA)

message(STATUS "Building boost.math with CUDA")
Expand Down
27 changes: 27 additions & 0 deletions test/check_cmake_version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Check whether the version in CMakeLists.txt is up to date
//
// Copyright 2018 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

#include <boost/core/lightweight_test.hpp>
#include <boost/version.hpp>
#include <cstdio>

int main( int ac, char const* av[] )
{
BOOST_TEST_EQ( ac, 2 );

if( ac >= 2 )
{
char version[ 64 ];
std::sprintf( version, "%d.%d.%d", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100 );

BOOST_TEST_CSTR_EQ( av[1], version );
}

return boost::report_errors();
}

0 comments on commit ff72eaa

Please sign in to comment.