Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists.txt: Needs CMAKE_CXX_STANDARD=11 #243

Closed
jenisys opened this issue Jun 8, 2019 · 1 comment
Closed

CMakeLists.txt: Needs CMAKE_CXX_STANDARD=11 #243

jenisys opened this issue Jun 8, 2019 · 1 comment

Comments

@jenisys
Copy link

jenisys commented Jun 8, 2019

Description

CMake build currently fails to compile on macOS (with AppleClang 10.0.0).
Doctest 2.2.2 / 2.3 or newer requires C++11 or newer, at least in the default configuration.
The default C++ compiler standard depends largely on the current toolchain / compiler version. Therefore, it would be much more robust to describe this requirement.

WORKAROUND: Fixes the problem

# -- FILE: doctest/CMakeLists.txt
...
project(doctest VERSION ${ver})
# CHANGE-NEEDED: Use C++11 standard as default for all C++ targets.
set(CMAKE_CXX_STANDARD 11)  
...

ALTERNATIVE:
Set target properties to CXX_STANDARD=11 on all examples/.../CMakeLists.txt files where this information is currently missing

Steps to reproduce

  1. Checkout / clone doctest git repository
  2. Run cmake build (with platform / toolchain environment described above)
cmake --build .
[2/44] Building CXX object examples/all_features/CMakeFiles/disabled.dir/alternative_macros.cpp.o
FAILED: examples/all_features/CMakeFiles/disabled.dir/alternative_macros.cpp.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DDOCTEST_CONFIG_DISABLE -I../scripts/development_only -I../doctest/parts -Werror -pedantic -pedantic-errors -fvisibility=hidden -fstrict-aliasing -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++98-compat-bind-to-temporary-copy -Wno-c++98-compat-local-type-template-args -Qunused-arguments -fcolor-diagnostics -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk   -Wno-unknown-warning-option -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-template -MD -MT examples/all_features/CMakeFiles/disabled.dir/alternative_macros.cpp.o -MF examples/all_features/CMakeFiles/disabled.dir/alternative_macros.cpp.o.d -o examples/all_features/CMakeFiles/disabled.dir/alternative_macros.cpp.o -c ../examples/all_features/alternative_macros.cpp
In file included from ../examples/all_features/alternative_macros.cpp:1:
In file included from ../examples/all_features/doctest_proxy.h:6:
In file included from ../scripts/development_only/doctest/doctest.h:1:
../doctest/parts/doctest_fwd.h:400:1: error: inline namespaces are a C++11 feature [-Werror,-Wc++11-inline-namespace]
DOCTEST_STD_NAMESPACE_BEGIN
^
... (more C++11 compile errors)

Extra information

  • doctest version: v2.2.2 or newer (also current HEAD)
  • Operating System: macOS 10.14
  • Compiler+version: AppleClang 10.0.0
@onqtam
Copy link
Member

onqtam commented Jun 11, 2019

Thanks for reporting! Seems that this is not enough - we forgot the case when someone is building the doctest repository itself (and not using it as a sub project)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants