From 77d2d6825a655c45986a75100095e00025e75383 Mon Sep 17 00:00:00 2001 From: Konstantin Goncharik Date: Sun, 10 Oct 2021 05:35:58 +0700 Subject: [PATCH] Workaround for config_types.h.in to use CMake and configure side-by-side --- CMakeLists.txt | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9ab7b0d..bd2ca8f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,10 +50,25 @@ endfunction() message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION}") -# Configure config_type.h -check_include_files(inttypes.h INCLUDE_INTTYPES_H) -check_include_files(stdint.h INCLUDE_STDINT_H) -check_include_files(sys/types.h INCLUDE_SYS_TYPES_H) +# Configure config_type.h (workaround to work both configure and cmake) +set(INCLUDE_INTTYPES_H 0) +set(INCLUDE_STDINT_H 0) +set(INCLUDE_SYS_TYPES_H 0) +check_include_files(inttypes.h INCLUDE_INTTYPES_H_) +check_include_files(stdint.h INCLUDE_STDINT_H_) +check_include_files(sys/types.h INCLUDE_SYS_TYPES_H_) + +if(INCLUDE_INTTYPES_H_ EQUAL 1) + set(INCLUDE_INTTYPES_H 1) +endif() + +if(INCLUDE_STDINT_H_ EQUAL 1) + set(INCLUDE_STDINT_H 1) +endif() + +if(INCLUDE_SYS_TYPES_H_ EQUAL 1) + set(INCLUDE_SYS_TYPES_H 1) +endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(SIZE16 int16_t)