From 4a69db787dbb669b9c8c8ffc49a9897ed26a0367 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 3 Jun 2018 21:49:01 +0200 Subject: [PATCH] Allow to create header for feature detection The header will only contain some preprocessor conditions. CMake will *not* do checks with the current compiler. --- cmake/modules/BasicConfig.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 2d3c18b..cd87d59 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -119,6 +119,17 @@ endif() # set TARGET_EXECUTABLE which is used to refer to the target executable at its installation location set(TARGET_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bin/${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}") +# create header for feature detection +if (META_REQUIRED_FEATURES) + include(WriteCompilerDetectionHeader) + write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/resources/features.h" + PREFIX "${META_PROJECT_VARNAME_UPPER}" + COMPILERS GNU Clang + FEATURES ${META_REQUIRED_FEATURES} + ) +endif() + # disable new ABI (can't catch ios_base::failure with new ABI) option(FORCE_OLD_ABI "specifies whether usage of old ABI should be forced" OFF) if(FORCE_OLD_ABI)