diff options
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | cmake/tests.cmake | 1 | ||||
-rw-r--r-- | example/single-header.cpp | 43 | ||||
-rw-r--r-- | include/afio/revision.hpp | 6 |
4 files changed, 58 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5feb59e5..fd9a94d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,8 +168,18 @@ foreach(lib afio_sl afio_dl) target_compile_definitions(${lib} INTERFACE AFIO_HEADERS_ONLY=0) target_compile_definitions(${lib} PRIVATE AFIO_SOURCE=1) endforeach() +set(compiler_has_cxx_17 0) +foreach(feature ${CMAKE_CXX_COMPILE_FEATURES}) + if(feature STREQUAL "cxx_std_17") + set(compiler_has_cxx_17 1) + endif() +endforeach() # The single header test requires C++ 17 -target_compile_features(afio-example_single-header PRIVATE cxx_std_17) +if(compiler_has_cxx_17) + target_compile_features(afio-example_single-header PRIVATE cxx_std_17) +else() + set_target_properties(afio-example_single-header PROPERTIES EXCLUDE_FROM_ALL ON EXCLUDE_FROM_DEFAULT_BUILD ON) +endif() # For all possible configurations of this library, add each test include(QuickCppLibMakeStandardTests) diff --git a/cmake/tests.cmake b/cmake/tests.cmake index 7f9f7aad..895f5fd5 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -24,6 +24,7 @@ set(afio_TESTS ) # DO NOT EDIT, GENERATED BY SCRIPT set(afio_COMPILE_TESTS + "example/single-header.cpp" "example/use_cases.cpp" ) # DO NOT EDIT, GENERATED BY SCRIPT diff --git a/example/single-header.cpp b/example/single-header.cpp new file mode 100644 index 00000000..4b0a4443 --- /dev/null +++ b/example/single-header.cpp @@ -0,0 +1,43 @@ +/* Sanity check on the single file edition +(C) 2018 Niall Douglas <http://www.nedproductions.biz/> (2 commits) +File Created: Jun 2018 + + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License in the accompanying file +Licence.txt or at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +Distributed under the Boost Software License, Version 1.0. + (See accompanying file Licence.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if __has_include("../single-header/afio-win.hpp") && (_HAS_CXX17 || __cplusplus >= 201700) +#ifdef _WIN32 +#include "../single-header/afio-win.hpp" +#else +#include "../single-header/afio-posix.hpp" +#endif + +int main() +{ + AFIO_V2_NAMESPACE::mapped_file_handle v; + (void) v; + return 0; +} +#else +int main() +{ + return 0; +} +#endif diff --git a/include/afio/revision.hpp b/include/afio/revision.hpp index edac0620..6d468c7f 100644 --- a/include/afio/revision.hpp +++ b/include/afio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define AFIO_PREVIOUS_COMMIT_REF 5854802f283de2b9c5026ea1a905ffdde1b09034 -#define AFIO_PREVIOUS_COMMIT_DATE "2018-06-19 09:00:24 +00:00" -#define AFIO_PREVIOUS_COMMIT_UNIQUE 5854802f +#define AFIO_PREVIOUS_COMMIT_REF 305934b3c3b97e476e018ca6a210df923ad5546a +#define AFIO_PREVIOUS_COMMIT_DATE "2018-06-19 19:29:30 +00:00" +#define AFIO_PREVIOUS_COMMIT_UNIQUE 305934b3 |