From 0ea66542289a560310edeacf8dabab3ce6a663bd Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Tue, 12 Feb 2013 19:01:16 +0100 Subject: [PATCH] Cmake build: Creating a define for a header file found need now only changes in the list of header files in ConfigureChecks.cmake. --- CMakeLists.txt | 2 -- development/cmake/ConfigureChecks.cmake | 33 ++++++++++++------------ development/cmake/configCompiler.h.cmake | 14 ++-------- development/cmake/configIncludes.cmake | 17 ++++++++++++ 4 files changed, 35 insertions(+), 31 deletions(-) create mode 100644 development/cmake/configIncludes.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 68c7d0323c..abf9ce0e20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -696,8 +696,6 @@ if(MSVC AND NOT LYX_CONFIGURE_CHECKS) configure_file(${LYX_CMAKE_DIR}/configCompiler.h.msvc ${TOP_BINARY_DIR}/configCompiler.h) else() include(${LYX_CMAKE_DIR}/ConfigureChecks.cmake) - configure_file(${LYX_CMAKE_DIR}/configFunctions.cmake ${TOP_BINARY_DIR}/configFunctions.h.cmake) - configure_file(${TOP_BINARY_DIR}/configFunctions.h.cmake ${TOP_BINARY_DIR}/configFunctions.h) configure_file(${LYX_CMAKE_DIR}/configCompiler.h.cmake ${TOP_BINARY_DIR}/configCompiler.h) endif() diff --git a/development/cmake/ConfigureChecks.cmake b/development/cmake/ConfigureChecks.cmake index a18b1b77ab..b6b0b1476b 100644 --- a/development/cmake/ConfigureChecks.cmake +++ b/development/cmake/ConfigureChecks.cmake @@ -17,29 +17,26 @@ include(TestBigEndian) test_big_endian(WORDS_BIGENDIAN) -check_include_file_cxx(aspell.h HAVE_ASPELL_H) -check_include_file_cxx(aspell/aspell.h HAVE_ASPELL_ASPELL_H) #check_include_file_cxx(istream HAVE_ISTREAM) #check_include_file_cxx(ostream HAVE_OSTREAM) -#check_include_file_cxx(ios HAVE_IOS) #check_include_file_cxx(sstream HAVE_SSTREAM) +#check_include_file_cxx(ios HAVE_IOS) #check_include_file_cxx(locale HAVE_LOCALE) -check_include_files(limits.h HAVE_LIMITS_H) -check_include_files(locale.h HAVE_LOCALE_H) -check_include_files(stdlib.h HAVE_STDLIB_H) -check_include_files(sys/stat.h HAVE_SYS_STAT_H) -check_include_files(sys/time.h HAVE_SYS_TIME_H) -check_include_files(sys/types.h HAVE_SYS_TYPES_H) -check_include_files(sys/utime.h HAVE_SYS_UTIME_H) -check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) -check_include_files(unistd.h HAVE_UNISTD_H) -check_include_files(inttypes.h HAVE_INTTYPES_H) -check_include_files(utime.h HAVE_UTIME_H) -check_include_files(string.h HAVE_STRING_H) -check_include_files(argz.h HAVE_ARGZ_H) +# defines will be written to configIncludes.h +set(Include_Defines) +foreach(_h_file aspell.h aspell/aspell.h limits.h locale.h + stdlib.h sys/stat.h sys/time.h sys/types.h sys/utime.h + sys/socket.h unistd.h inttypes.h utime.h string.h argz.h) + string(REGEX REPLACE "[/\\.]" "_" _hf ${_h_file}) + string(TOUPPER ${_hf} _HF) + check_include_files(${_h_file} HAVE_${_HF}) + set(Include_Defines "${Include_Defines}#cmakedefine HAVE_${_HF} 1\n") +endforeach() +configure_file(${LYX_CMAKE_DIR}/configIncludes.cmake ${TOP_BINARY_DIR}/configIncludes.h.cmake) +configure_file(${TOP_BINARY_DIR}/configIncludes.h.cmake ${TOP_BINARY_DIR}/configIncludes.h) -set(_function_file ${TOP_BINARY_DIR}/configFunctions.h.cmake) +# defines will be written to configFunctions.h set(Function_Defines) foreach(_f alloca __argz_count __argz_next __argz_stringify chmod close _close dcgettext fcntl fork __fsetlocking @@ -50,6 +47,8 @@ foreach(_f alloca __argz_count __argz_next __argz_stringify check_function_exists(${_f} HAVE_${_UF}) set(Function_Defines "${Function_Defines}#cmakedefine HAVE_${_UF} 1\n") endforeach() +configure_file(${LYX_CMAKE_DIR}/configFunctions.cmake ${TOP_BINARY_DIR}/configFunctions.h.cmake) +configure_file(${TOP_BINARY_DIR}/configFunctions.h.cmake ${TOP_BINARY_DIR}/configFunctions.h) check_symbol_exists(alloca "malloc.h" HAVE_SYMBOL_ALLOCA) check_symbol_exists(asprintf "stdio.h" HAVE_ASPRINTF) diff --git a/development/cmake/configCompiler.h.cmake b/development/cmake/configCompiler.h.cmake index 65e08a01f5..e833a036e1 100644 --- a/development/cmake/configCompiler.h.cmake +++ b/development/cmake/configCompiler.h.cmake @@ -13,23 +13,13 @@ #define _CONFIG_COMPILER_H -#cmakedefine HAVE_LIMITS_H 1 -#cmakedefine HAVE_LOCALE_H 1 -#cmakedefine HAVE_STDLIB_H 1 -#cmakedefine HAVE_SYS_STAT_H 1 -#cmakedefine HAVE_SYS_TIME_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 -#cmakedefine HAVE_SYS_UTIME_H 1 -#cmakedefine HAVE_SYS_SOCKET_H 1 -#cmakedefine HAVE_UNISTD_H 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_UTIME_H 1 -#cmakedefine HAVE_STRING_H 1 #cmakedefine HAVE_ISTREAM 1 #cmakedefine HAVE_OSTREAM 1 #cmakedefine HAVE_IOS 1 #cmakedefine HAVE_LOCALE 1 +#include "configIncludes.h" + #include "configFunctions.h" #cmakedefine HAVE_STD_COUNT 1 diff --git a/development/cmake/configIncludes.cmake b/development/cmake/configIncludes.cmake new file mode 100644 index 0000000000..fb9135bf68 --- /dev/null +++ b/development/cmake/configIncludes.cmake @@ -0,0 +1,17 @@ +/* + * \file configIncludes.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * This is the compilation configuration file for LyX. + * It was generated by cmake. + * You might want to change some of the defaults if something goes wrong + * during the compilation. + */ + +#ifndef _CONFIG_INCLUDES_H +#define _CONFIG_INCLUDES_H + +${Include_Defines} + +#endif -- 2.39.2