mirror of https://github.com/CGAL/cgal
fix version checker
the 3 major/minor/patch are needed to compare integrals if they are defined, the version check is done and warning or error are displayed
This commit is contained in:
parent
5a7f0252ac
commit
571536f09c
|
|
@ -117,7 +117,7 @@
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
#include <CGAL/version.h>
|
#include <CGAL/version.h>
|
||||||
#include <CGAL/version_enforcer.h>
|
#include <CGAL/version_checker.h>
|
||||||
|
|
||||||
//----------------------------------------------------------------------//
|
//----------------------------------------------------------------------//
|
||||||
// platform specific workaround flags (CGAL_CFG_...)
|
// platform specific workaround flags (CGAL_CFG_...)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
// Copyright (c) 2023 GeometryFactory.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of CGAL (www.cgal.org)
|
||||||
|
//
|
||||||
|
// $URL$
|
||||||
|
// $Id$
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||||
|
//
|
||||||
|
// Author(s) : -
|
||||||
|
|
||||||
|
#ifndef CGAL_VERSION_CHECKER_H
|
||||||
|
#define CGAL_VERSION_CHECKER_H
|
||||||
|
|
||||||
|
#include <CGAL/version_macros.h>
|
||||||
|
|
||||||
|
// All files including this header are meant to work with a given version of CGAL
|
||||||
|
// When using forked headers, set the following macro to the version of CGAL
|
||||||
|
// you want to use.
|
||||||
|
|
||||||
|
//// Set the 3 following macros to the version of CGAL you want to use
|
||||||
|
//#define CGAL_AUTHORIZED_VERSION_MAJOR 6
|
||||||
|
//#define CGAL_AUTHORIZED_VERSION_MINOR 0
|
||||||
|
//#define CGAL_AUTHORIZED_VERSION_PATCH 0
|
||||||
|
|
||||||
|
// Set the following macros to 1 to get a warning/an error
|
||||||
|
// when using a bad version of CGAL
|
||||||
|
#define CGAL_VERSION_CHECKER_ERROR 0
|
||||||
|
#define CGAL_VERSION_CHECKER_WARNING 0
|
||||||
|
|
||||||
|
#define CGAL_AUTHORIZED_VERSION_STR CGAL_STR(CGAL_AUTHORIZED_VERSION_MAJOR) "." \
|
||||||
|
CGAL_STR(CGAL_AUTHORIZED_VERSION_MINOR) "." \
|
||||||
|
CGAL_STR(CGAL_AUTHORIZED_VERSION_PATCH)
|
||||||
|
|
||||||
|
|
||||||
|
// Check that the version of CGAL used is the one expected
|
||||||
|
#if CGAL_AUTHORIZED_VERSION_MAJOR != CGAL_VERSION_MAJOR \
|
||||||
|
|| CGAL_AUTHORIZED_VERSION_MINOR != CGAL_VERSION_MINOR \
|
||||||
|
|| CGAL_AUTHORIZED_VERSION_PATCH != CGAL_VERSION_PATCH
|
||||||
|
|
||||||
|
#if CGAL_VERSION_CHECKER_WARNING || CGAL_VERSION_CHECKER_ERROR
|
||||||
|
#pragma message("These headers are meant to be used with CGAL " CGAL_AUTHORIZED_VERSION_STR " only."\
|
||||||
|
" You are using CGAL version: " CGAL_STR(CGAL_VERSION) ".")
|
||||||
|
|
||||||
|
#ifdef CGAL_VERSION_CHECKER_ERROR
|
||||||
|
#error "Wrong version of CGAL"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CGAL_VERSION_CHECKER_H
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
// Copyright (c) 2023 GeometryFactory.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This file is part of CGAL (www.cgal.org)
|
|
||||||
//
|
|
||||||
// $URL$
|
|
||||||
// $Id$
|
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
|
||||||
//
|
|
||||||
// Author(s) : -
|
|
||||||
|
|
||||||
#ifndef CGAL_VERSION_ENFORCER_H
|
|
||||||
#define CGAL_VERSION_ENFORCER_H
|
|
||||||
|
|
||||||
#include <CGAL/version_macros.h>
|
|
||||||
|
|
||||||
// All files including this header are meant to work with a given version of CGAL
|
|
||||||
// When using forked headers, set the 4 following macros to the version of CGAL
|
|
||||||
// you want to use.
|
|
||||||
#define CGAL_AUTHORIZED_VERSION_STR CGAL_VERSION_STR
|
|
||||||
#define CGAL_AUTHORIZED_VERSION_MAJOR CGAL_VERSION_MAJOR
|
|
||||||
#define CGAL_AUTHORIZED_VERSION_MINOR CGAL_VERSION_MINOR
|
|
||||||
#define CGAL_AUTHORIZED_VERSION_PATCH CGAL_VERSION_PATCH
|
|
||||||
|
|
||||||
// Check that the version of CGAL used is the one expected
|
|
||||||
#if (CGAL_VERSION_MAJOR != CGAL_AUTHORIZED_VERSION_MAJOR)
|
|
||||||
#pragma message "You are using CGAL version: " CGAL_STR(CGAL_VERSION) "."
|
|
||||||
#error This header is meant to be with used with CGAL "CGAL_AUTHORIZED_VERSION_STR" only."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (CGAL_VERSION_MINOR != CGAL_AUTHORIZED_VERSION_MINOR)
|
|
||||||
#pragma message "You are using CGAL version: " CGAL_STR(CGAL_VERSION) "."
|
|
||||||
#error This header is meant to be with used with CGAL "CGAL_AUTHORIZED_VERSION_STR" only.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (CGAL_VERSION_PATCH != CGAL_AUTHORIZED_VERSION_PATCH)
|
|
||||||
#pragma message "You are using CGAL version: " CGAL_STR(CGAL_VERSION) "."
|
|
||||||
#error This header is meant to be with used with CGAL "CGAL_AUTHORIZED_VERSION_STR" only."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // CGAL_VERSION_ENFORCER_H
|
|
||||||
Loading…
Reference in New Issue