From ba06695387810c9e391a598da42f6275f200d01d Mon Sep 17 00:00:00 2001 From: malaterre Date: Wed, 8 Jun 2005 13:32:49 +0000 Subject: [PATCH] ENH: Adding support for checking if inline keyword is supported by C compiler --- src/gdcmjpegls/CMakeLists.txt | 38 +++++++++++++++++++ src/gdcmjpegls/Decoder/CMakeLists.txt | 8 +--- .../{Decoder => }/jpegls_config.h.in | 0 3 files changed, 39 insertions(+), 7 deletions(-) rename src/gdcmjpegls/{Decoder => }/jpegls_config.h.in (100%) diff --git a/src/gdcmjpegls/CMakeLists.txt b/src/gdcmjpegls/CMakeLists.txt index b1aa20e0..36dd4d94 100644 --- a/src/gdcmjpegls/CMakeLists.txt +++ b/src/gdcmjpegls/CMakeLists.txt @@ -1,5 +1,43 @@ PROJECT(GDCMJPEGLS) +#----------------------------------------------------------------------------- +# Test if os defines a lenght for sockaddr +# only doing the test when we have sys/socket +IF( ${CMAKE_HAVE_C_INLINE} ) + MESSAGE(FATAL_ERROR "bla"); + IF("HAVE_C_INLINE" MATCHES "^HAVE_C_INLINE$") + STRING(ASCII 35 POUND) + FILE(WRITE ${GDCMJPEGLS_BINARY_DIR}/gdcmTestInline.c + "inline int foo() { return 0; }") + MESSAGE(STATUS "Checking if C compiler has inline keyword") + TRY_COMPILE(HAVE_C_INLINE + ${GDCMJPEGLS_BINARY_DIR} + ${GDCMJPEGLS_BINARY_DIR}/gdcmTestHAVESALEN.c + OUTPUT_VARIABLE OUTPUT) + IF(HAVE_C_INLINE) + MESSAGE(STATUS "Checking if C compiler has inline keyword -- yes") + SET(HAVE_C_INLINE 1 CACHE INTERNAL "Support if C compiler has inline keyword") + WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeOutput.log + "Determining if C compiler has inline keyword" + "passed with the following output:\n" + "${OUTPUT}\n" APPEND) + ELSE(HAVE_C_INLINE) + MESSAGE(STATUS "Checking if C compiler has inline keyword -- no") + SET(HAVE_C_INLINE 0 CACHE INTERNAL "Support if C compiler has inline keyword") + WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log + "Determining if C compiler has inline keyword" + "failed with the following output:\n" + "${OUTPUT}\n" APPEND) + ENDIF(HAVE_C_INLINE) + ENDIF("HAVE_C_INLINE" MATCHES "^HAVE_C_INLINE$") +ENDIF( ${CMAKE_HAVE_C_INLINE} ) + +CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) +CONFIGURE_FILE( + "${GDCMJPEGLS_SOURCE_DIR}/jpegls_config.h.in" + "${GDCMJPEGLS_BINARY_DIR}/jpegls_config.h" + @ONLY IMMEDIATE) + SUBDIRS(Decoder # Encoder ) diff --git a/src/gdcmjpegls/Decoder/CMakeLists.txt b/src/gdcmjpegls/Decoder/CMakeLists.txt index 8f780915..35f9baeb 100644 --- a/src/gdcmjpegls/Decoder/CMakeLists.txt +++ b/src/gdcmjpegls/Decoder/CMakeLists.txt @@ -1,12 +1,6 @@ INCLUDE_REGULAR_EXPRESSION("^.*$") -CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) -CONFIGURE_FILE( - "${GDCMJPEGLS_SOURCE_DIR}/Decoder/jpegls_config.h.in" - "${GDCMJPEGLS_BINARY_DIR}/Decoder/jpegls_config.h" - @ONLY IMMEDIATE) - -INCLUDE_DIRECTORIES("${GDCMJPEGLS_BINARY_DIR}/Decoder") +INCLUDE_DIRECTORIES("${GDCMJPEGLS_BINARY_DIR}") SET(GDCMJPEGLS_SRCS global.c diff --git a/src/gdcmjpegls/Decoder/jpegls_config.h.in b/src/gdcmjpegls/jpegls_config.h.in similarity index 100% rename from src/gdcmjpegls/Decoder/jpegls_config.h.in rename to src/gdcmjpegls/jpegls_config.h.in -- 2.48.1