尝试通过CGAL_CXX_FLAGS设置 --std=c++0x 或 -std=gnu++0x 会忽略值

Trying to set --std=c++0x or -std=gnu++0x via CGAL_CXX_FLAGS ignores values

本文关键字:-std c++0x gnu++0x --std CGAL CXX 设置 FLAGS      更新时间:2023-10-16

我正在尝试编译一些将使用 CGAL 但使用产生错误的包含文件的代码。该错误说使用 -std=c++0x-std=gnu++0x 进行编译。

如果我将-std=c++0x-std=gnu++0x添加到CGAL_CXX_FLAGS i,e cmake -DCGAL_CXX_FLAGS='-std=c++0x or -std=gnu++0x -I等,它只是忽略了我为CGAL_CXX_FLAGS设置的内容。

如果我从CGAL_CXX_FLAGS中省略-std=c++0x-std=gnu++0x,它将C++编译器标志设置为正常,但在编译包含文件时失败。

语法

cmake -DCGAL_CXX_FLAGS='-std=c++0x

不正确。CMake 在没有任何警告的情况下接受这种形式的 -D 选项,但该行为不是您想要的。查看 CMake 的文档。正确的形式如下:

cmake -DCGAL_CXX_FLAGS:STRING='-std=c++0x'