Open sloriot opened 1 year ago
The implementation uses the macro CGAL_pragma_warning
:
https://github.com/CGAL/cgal/blob/04b5104b5b95c597250dbe74d708e6e9ab4e80db/Installation/include/CGAL/license/TDS_2.h#L40-L44
defined here: https://github.com/CGAL/cgal/blob/04b5104b5b95c597250dbe74d708e6e9ab4e80db/Installation/include/CGAL/config.h#L524-L537
With clang++ versions 15 or 16, that works:
[build] /home/lrineau/Git/cgal/Installation/include/CGAL/license/TDS_2.h:41:6: warning: warning:
[build] The macro CGAL_TDS_2_COMMERCIAL_LICENSE is not defined.
[build] You use the CGAL 2D Triangulation Data Structure package under the terms of the GPLv3+. [-W#pragma-messages]
[build] CGAL_pragma_warning("\nThe macro CGAL_TDS_2_COMMERCIAL_LICENSE is not defined."
[build] ^
[build] /home/lrineau/Git/cgal/Installation/include/CGAL/config.h:548:37: note: expanded from macro 'CGAL_pragma_warning'
[build] # define CGAL_pragma_warning(desc) _Pragma(CGAL_STRINGIZE(CGAL_WARNING(desc)))
[build] ^
[build] <scratch space>:42:2: note: expanded from here
[build] message( "warning: " "\nThe macro CGAL_TDS_2_COMMERCIAL_LICENSE is not defined." "\nYou use the CGAL 2D Triangulation Data Structure package under " "the terms of the GPLv3+.")
[build] ^
So, now we should check the support of #pragma message
with earlier versions of clang.
And probably test that in the testsuite. With CTest we can make test fail if their output do not match a regular expression.
Works with recent version, let's close it.
Actually, I understood what is going on (including with latest version of clang).
If you use the -isystem
options, pragma message
are not displayed by clang but are by gcc. Even is we put --no-system-header-prefix=CGAL/license/
, it does not work except if the package license file is included by a file that is not considered as a system one (like your main.cpp
for exemple).
What I propose as a fix is to add a cmake option that will activate license checking (ERROR or WARNING), that will first define the c++ macros but also does not set CGAL as system include.
with
Debian clang version 11.0.1-2
does not produce any warning._ERROR
version works.