SET (LIBRARY_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
+#-----------------------------------------------------------------------------
+# Test if compiler defines __FUNCTION__
+IF("GDCM_COMPILER_HAS_FUNCTION" MATCHES "^GDCM_COMPILER_HAS_FUNCTION$")
+ MESSAGE(STATUS "Checking support for __FUNCTION__ in compiler")
+ TRY_COMPILE(GDCM_COMPILER_HAS_FUNCTION
+ ${GDCM_BINARY_DIR}/CMakeTmp/Function
+ ${GDCM_SOURCE_DIR}/gdcmTestFUNCTION.cxx
+ OUTPUT_VARIABLE OUTPUT)
+ IF(GDCM_COMPILER_HAS_FUNCTION)
+ MESSAGE(STATUS "Checking support for __FUNCTION__ -- yes")
+ SET(GDCM_COMPILER_HAS_FUNCTION 1 CACHE INTERNAL "Support for extention C __FUNCTION__")
+ WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeOutput.log
+ "Determining if the C compiler supports __FUNCTION__ "
+ "passed with the following output:\n"
+ "${OUTPUT}\n" APPEND)
+ ELSE(GDCM_COMPILER_HAS_FUNCTION)
+ MESSAGE(STATUS "Checking support for __FUNCTION__ -- no")
+ SET(GDCM_COMPILER_HAS_FUNCTION 0 CACHE INTERNAL "Support for extension C __FUNCTION__")
+ WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
+ "Determining if the C compiler supports __FUNCTION__ "
+ "failed with the following output:\n"
+ "${OUTPUT}\n" APPEND)
+ ENDIF(GDCM_COMPILER_HAS_FUNCTION)
+ENDIF("GDCM_COMPILER_HAS_FUNCTION" MATCHES "^GDCM_COMPILER_HAS_FUNCTION$")
#-----------------------------------------------------------------------------
# Build directory on which many applications depend
SUBDIRS(
Program: gdcm
Module: $RCSfile: gdcmDebug.h,v $
Language: C++
- Date: $Date: 2005/01/07 20:31:36 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2005/01/07 21:09:42 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// __FUNCTION is not always defined by preprocessor
// In c++ we should use __PRETTY_FUNCTION__ instead...
-#ifndef __GNUC__
-# define __FUNCTION__ "<unknow>"
-#endif
+#ifdef GDCM_COMPILER_HAS_FUNCTION
+// Handle particular case for GNU C++ which also defines __PRETTY_FUNCTION__
+// which is a lot nice in C++
+#ifdef __GNUC__
+# define GDCM_FUNCTION __PRETTY_FUNCTION__
+#else
+# define GDCM_FUNCTION __FUNCTION__
+#endif //__GNUC__
+#else
+# define GDCM_FUNCTION "<unknow>"
+#endif //GDCM_COMPILER_HAS_FUNCTION
/**
* \brief Debug
{ \
std::ostringstream osmacro; \
osmacro << "Debug: In " __FILE__ ", line " << __LINE__ \
- << ", function " << __FUNCTION__ << '\n' \
+ << ", function " << GDCM_FUNCTION << '\n' \
<< msg << "\n\n"; \
std::cerr << osmacro.str() << std::endl; \
} \
{ \
std::ostringstream osmacro; \
osmacro << "Verbose: In " __FILE__ ", line " << __LINE__ \
- << ", function " << __FUNCTION__ << "\n" \
+ << ", function " << GDCM_FUNCTION << "\n" \
<< msg << "\n\n"; \
std::cerr << osmacro.str() << std::endl; \
} \
{ \
std::ostringstream osmacro; \
osmacro << "Error: In " __FILE__ ", line " << __LINE__ \
- << ", function " << __FUNCTION__ << '\n' \
+ << ", function " << GDCM_FUNCTION << '\n' \
<< msg << "\n\n"; \
std::cerr << osmacro.str() << std::endl; \
exit(1); \
{ \
std::ostringstream osmacro; \
osmacro << "Assert: In " __FILE__ ", line " << __LINE__ \
- << ", function " << __FUNCTION__ \
+ << ", function " << GDCM_FUNCTION \
<< "\n\n"; \
std::cerr << osmacro.str() << std::endl; \
assert ( arg ); \
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/07 19:20:38 $
- Version: $Revision: 1.94 $
+ Date: $Date: 2005/01/07 21:09:42 $
+ Version: $Revision: 1.95 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <sys/types.h>
#ifdef _MSC_VER
-#define getcwd _getcwd
+# define getcwd _getcwd
#endif
-#if defined( _MSC_VER) || defined(__BORLANDC__)
- #include <direct.h>
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+# include <direct.h>
#else
- #include <unistd.h>
+# include <unistd.h>
#endif
namespace gdcm