From 63994498c61da200f072eef3ac9f7ba6d4c2d844 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Mon, 30 Dec 2019 03:15:27 -0500 Subject: [PATCH 1/2] Add missing `Skyr_DISABLE_LIBCXX` option deceleration in top level CMakeLists.txt The option deceleration is missing, yet it is used for setting up the `stdlib=stdc++` flag for clang. Cmake option has the default value of `OFF`; the value is negated in the if statement so by default the flag is appended regardless of whether the machine has `stdc++` installed. Since some Clang installations do not come with `stdc++`, the project cannot be built. The default value is set to `ON` since LLVM's implementation of C++17 is not yet complete. More can be found in the links below: - [cppreference](https://en.cppreference.com/w/cpp/compiler_support) - [libc++ on 17](https://libcxx.llvm.org/cxx1z_status.html) - [libc++ homepage](https://libcxx.llvm.org/index.html) --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b676d47b..18fd4ea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ option(Skyr_WARNINGS_AS_ERRORS "Treat warnings as errors." ON) option(Skyr_BUILD_WITHOUT_EXCEPTIONS "Build without exceptions." OFF) option(Skyr_USE_STATIC_CRT "Use static C Runtime library (/MT or MTd)." ON) option(Skyr_BUILD_FILESYSTEM_PATH_FUNCTIONS "Build the filesystem path functions" OFF) +option(Skyr_DISABLE_LIBCXX "Instruct Clang to use LLVM's implementation of C++ standard library" ON) set(CMAKE_VERBOSE_MAKEFILE true) set(CMAKE_CXX_STANDARD 17) From ba48cff998a9a8d7f14495074c061e255caa2bf6 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Mon, 30 Dec 2019 03:18:57 -0500 Subject: [PATCH 2/2] Improve standard compliance By default if `CMAKE_CXX_EXTENSIONS` and `CMAKE_CXX_STANDARD_REQUIRED` are not set, cmake would allow non-standard C++ extensions. For instance it would pass `-std=gnu++17` instead of `-std=c++17` to GCC. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18fd4ea7..f87a0b3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,8 @@ option(Skyr_DISABLE_LIBCXX "Instruct Clang to use LLVM's implementation of C++ s set(CMAKE_VERBOSE_MAKEFILE true) set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Threads REQUIRED) find_package(tl-expected CONFIG REQUIRED)