From e87a0e29976d5bb7fde6df93951a87a23323ce50 Mon Sep 17 00:00:00 2001 From: "Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com)" Date: Fri, 8 Jul 2016 09:33:30 +0100 Subject: Now actually generating proper precompiled headers thanks to some undocumented cmake support for precompiled headers. Woohoo. --- CMakeLists.txt | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 81f9fa75..5549dde3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,24 +13,18 @@ set(PROJECT_NAMESPACE boost::) # Update this header file with the current git SHA and last timestamp UpdateRevisionHppFromGit("${CMAKE_CURRENT_SOURCE_DIR}/include/boost/afio/revision.hpp") -# Make an interface only library so dependent CMakeLists can bring in this header-only library -include(BoostLiteMakeHeaderOnlyLibrary) -# Anyone using the static or dynamic libraries is not using the header only variant -set(afio_NON_HEADER_ONLY_COMPILE_DEFINITIONS INTERFACE BOOST_AFIO_HEADERS_ONLY=0) # Make the standard static and shared libraries, and if supported by this compiler, C++ modules # for both static and shared libraries as well. For the non-C++ module variants, makes the # interface headers into precompiled headers. Only builds all of them if this is the topmost # CMakeLists, else built only if something upstream is dependent on one of them. include(BoostLiteMakeLibrary) +# Make an interface only library so dependent CMakeLists can bring in this header-only library +include(BoostLiteMakeHeaderOnlyLibrary) +# Set the standard definitions for these libraries and bring in the all_* helper functions +include(BoostLiteApplyDefaultDefinitions) # Set the C++ features this library requires -foreach(lib afio_sl afio_dl) - if(${lib} STREQUAL afio_hl) - set(PUBLIC INTERFACE) - else() - set(PUBLIC PUBLIC) - endif() - target_compile_features(${lib} ${PUBLIC} +all_compile_features(PUBLIC # cxx_exceptions ## Annoyingly not supported by cmake 3.4 cxx_alias_templates cxx_variadic_templates @@ -41,6 +35,9 @@ foreach(lib afio_sl afio_dl) cxx_attributes cxx_variable_templates ) - unset(PUBLIC) + +# Anyone using the static or dynamic libraries is not using the header only variant +foreach(lib afio_sl afio_dl) + target_compile_definitions(${lib} INTERFACE BOOST_AFIO_HEADERS_ONLY=0) endforeach() -- cgit v1.2.3