CppUnit project page CppUnit home page

autolink.h

Go to the documentation of this file.
00001 // No gards, this header can be included multiple time
00002 
00003 // Generic header to automatically link against a specified library
00004 // The library name prefix must be defined in CPPUT_LIB_NAME.
00005 // CPPUT_LIB_NAME will be undefined after including this header.
00006 
00007 // The full library name is build according to the followin rules:
00008 // (0) CPPUT_LIB_NAME: library name prefix (lut,...)
00009 // (a) TOOLSET: vc6, vc7, bcb4, bcb5, bcb6
00010 // (b) THREADING: m(multithreaded), s(single threaded)
00011 // (c) DEBUG MODE: r(release), d(debug)
00012 // (d) LINKAGE: s(static), d(dynamic)
00013 // FULLNAME: 0_a_bcd.lib
00014 
00015 
00016 #if !defined(CPPUT_LIB_NAME)
00017 # error Macro CPPUT_LIB_NAME should be defined. You should not include this header directly.
00018 #endif
00019 
00020 
00021 // Select compiler
00022 #if defined(_MSC_VER) && (_MSC_VER == 1200) // VC6
00023 # define CPPUT_LIB_TOOLSET "vc6"
00024 #elif defined(_MSC_VER) && (_MSC_VER >= 1300) //VC7 (.NET 2002)
00025 # define CPPUT_LIB_TOOLSET "vc7"
00026 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) // CBuilder 6
00027 # define CPPUT_LIB_TOOLSET "bcb6"
00028 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
00029 # define CPPUT_LIB_TOOLSET "bcb5"
00030 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x540)
00031 # define CPPUT_LIB_TOOLSET "bcb4"
00032 #endif
00033 
00034 // Select threading
00035 #if defined(_MT) || defined(__MT__)
00036 # define CPPUT_LIB_THREADING "m"
00037 #else
00038 # define CPPUT_LIB_THREADING "s"
00039 #endif
00040 
00041 // Select debug mode
00042 #if defined(_DEBUG)
00043 # define CPPUT_LIB_DEBUG_MODE "d"
00044 #else
00045 # define CPPUT_LIB_DEBUG_MODE "r"
00046 #endif
00047 
00048 // Select linkage
00049 #if defined(CPPUT_STATIC_LINK)
00050 # define CPPUT_LIB_LINKAGE "s"
00051 #else
00052 # define CPPUT_LIB_LINKAGE "d"
00053 #endif
00054 
00055 // Automatic link
00056 #if defined(CPPUT_LIB_TOOLSET)    && \
00057     defined(CPPUT_LIB_THREADING)  && \
00058     defined(CPPUT_LIB_LINKAGE)    && \
00059     defined(CPPUT_LIB_DEBUG_MODE)
00060 # define CPPUT_LIB_FULL_NAME                                                     \
00061     CPPUT_LIB_NAME "_" CPPUT_LIB_TOOLSET "_" CPPUT_LIB_THREADING CPPUT_LIB_DEBUG_MODE \
00062     CPPUT_LIB_LINKAGE ".lib"
00063 # pragma comment(lib,CPPUT_LIB_FULL_NAME)
00064 #endif
00065 
00066 #undef CPPUT_LIB_TOOLSET
00067 #undef CPPUT_LIB_THREADING
00068 #undef CPPUT_LIB_LINKAGE
00069 #undef CPPUT_LIB_DEBUG_MODE
00070 #undef CPPUT_LIB_FULL_NAME
00071 #undef CPPUT_LIB_NAME
00072 

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers