]> Creatis software - gdcm.git/commitdiff
ENH: Adding support for checking if inline keyword is supported by C compiler
authormalaterre <malaterre>
Wed, 8 Jun 2005 13:32:49 +0000 (13:32 +0000)
committermalaterre <malaterre>
Wed, 8 Jun 2005 13:32:49 +0000 (13:32 +0000)
src/gdcmjpegls/CMakeLists.txt
src/gdcmjpegls/Decoder/CMakeLists.txt
src/gdcmjpegls/jpegls_config.h.in [moved from src/gdcmjpegls/Decoder/jpegls_config.h.in with 100% similarity]

index b1aa20e01525f54ef2270fadc136f879e4ef7056..36dd4d94dac24f9a905de7733fb7e66bcfed5ba5 100644 (file)
@@ -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
   )
index 8f7809153c5c45d107885898e858473049daa112..35f9baebc86e666a92fcad423a4e52d29b956574 100644 (file)
@@ -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