aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt20
-rw-r--r--cmake/configure.cmake34
-rw-r--r--extension/CMakeLists.txt13
3 files changed, 37 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01c98ace..80c3d501 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,27 +29,8 @@ project (gawk C)
include(cmake/configure.cmake)
-find_package(BISON REQUIRED)
-if (${BISON_FOUND} STREQUAL "TRUE")
- BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c)
-endif()
-#http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext
-find_package(Gettext REQUIRED)
-if (GETTEXT_FOUND STREQUAL "TRUE")
- include_directories(${GETTEXT_INCLUDE_DIR})
-else ()
- message( FATAL_ERROR "Gettext not found" )
-endif()
-find_package(LATEX)
-include(GNUInstallDirs)
-include(GetPrerequisites)
-
set (EXTRA_LIBS "")
-DefineLibraryIfAvailable(m sin "" HAVE_LIBM)
-DefineLibraryIfAvailable(mpfr mpfr_add_si "" HAVE_MPFR)
-DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS)
-
if (${HAVE_MPFR})
set (EXTRA_LIBS ${EXTRA_LIBS} mpfr gmp)
endif ()
@@ -57,7 +38,6 @@ if (${DYNAMIC})
set (EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_DL_LIBS} )
endif ()
-
include_directories(${CMAKE_SOURCE_DIR})
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
diff --git a/cmake/configure.cmake b/cmake/configure.cmake
index b0640706..9e896284 100644
--- a/cmake/configure.cmake
+++ b/cmake/configure.cmake
@@ -237,3 +237,37 @@ DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC)
add_definitions(-D HAVE_STRINGIZE)
add_definitions(-D _Noreturn=)
+find_package(BISON REQUIRED)
+if (${BISON_FOUND} STREQUAL "TRUE")
+ BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c)
+endif()
+
+#http://www.cmake.org/cmake/help/v2.8.10/cmake.html#module:FindGettext
+find_package(Gettext REQUIRED)
+if (GETTEXT_FOUND STREQUAL "TRUE")
+ include_directories(${GETTEXT_INCLUDE_DIR})
+else ()
+ message( FATAL_ERROR "Gettext not found" )
+endif()
+
+find_package(LATEX)
+include(GNUInstallDirs)
+include(GetPrerequisites)
+
+# For some unknown reason the defines for the extension
+# are written into config.h only if they are implemented
+# here and not in extension/CMakeLists.txt.
+DefineLibraryIfAvailable(m sin "" HAVE_LIBM)
+DefineLibraryIfAvailable(mpfr mpfr_add_si "" HAVE_MPFR)
+DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS)
+DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH)
+DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H)
+DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H)
+DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE)
+DefineFunctionIfAvailable(select HAVE_SELECT)
+DefineFunctionIfAvailable(gettimeofday HAVE_GETTIMEOFDAY)
+DefineHFileIfAvailable(sys/select.h HAVE_SYS_SELECT_H)
+DefineFunctionIfAvailable(nanosleep HAVE_NANOSLEEP)
+DefineHFileIfAvailable(time.h HAVE_TIME_H)
+DefineFunctionIfAvailable(GetSystemTimeAsFileTime HAVE_GETSYSTEMTIMEASFILETIME)
+
diff --git a/extension/CMakeLists.txt b/extension/CMakeLists.txt
index 9013bda3..31ae4fad 100644
--- a/extension/CMakeLists.txt
+++ b/extension/CMakeLists.txt
@@ -35,8 +35,6 @@ ENDMACRO(BuildExtension)
BuildExtension(filefuncs filefuncs.c stack.c gawkfts.c)
-DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH)
-DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H)
if (${HAVE_FNMATCH} AND ${HAVE_FNMATCH_H})
BuildExtension(fnmatch fnmatch.c)
else()
@@ -44,10 +42,11 @@ else()
endif()
BuildExtension(fork fork.c)
+
BuildExtension(inplace inplace.c)
+
BuildExtension(ordchr ordchr.c)
-DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H)
if (${HAVE_DIRENT_H})
BuildExtension(readdir readdir.c)
else()
@@ -55,9 +54,9 @@ else()
endif()
BuildExtension(readfile readfile.c)
+
BuildExtension(revoutput revoutput.c)
-DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE)
if (${HAVE_GETDTABLESIZE})
BuildExtension(revtwoway revtwoway.c)
else()
@@ -66,12 +65,6 @@ endif()
BuildExtension(rwarray rwarray.c)
-DefineFunctionIfAvailable(select HAVE_SELECT)
-DefineFunctionIfAvailable(gettimeofday HAVE_GETTIMEOFDAY)
-DefineHFileIfAvailable(sys/select.h HAVE_SYS_SELECT_H)
-DefineFunctionIfAvailable(nanosleep HAVE_NANOSLEEP)
-DefineHFileIfAvailable(time.h HAVE_TIME_H)
-DefineFunctionIfAvailable(GetSystemTimeAsFileTime HAVE_GETSYSTEMTIMEASFILETIME)
BuildExtension(time time.c)
BuildExtension(testext testext.c)