~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to .pc/force-use-shared-object-libs-upon-linking.patch/cmake/OpenMSBuildSystem_externalLibs.cmake

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-e6mvctvil4ko9npv
Tags: 1.9.0-1
1.9.0 First Debian package release (Closes: #691129).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
## contrib
 
3
 
 
4
set(CONTRIB_CUSTOM_DIR CACHE DOC "DEPRECATED: User defined location of contrib dir. If left empty we assume the contrib to be in OpenMS/contrib! Please use CMAKE_FIND_ROOT_PATH instead!")
 
5
set(CONTRIB_DIR ${PROJECT_SOURCE_DIR}/contrib/ CACHE INTERNAL "Final contrib path after looking at custom_contrib_path. defaults to OpenMS/contrib")
 
6
 
 
7
IF ("${CMAKE_FIND_ROOT_PATH}" STREQUAL "")
 
8
        IF (NOT "${CONTRIB_CUSTOM_DIR}" STREQUAL "")
 
9
                MESSAGE("Please do no longer use -DCONTRIB_CUSTOM_DIR. This option is deprecated. Please use -DCMAKE_FIND_ROOT_PATH instead.")
 
10
                LIST(INSERT CONTRIB_DIR 0 ${CONTRIB_CUSTOM_DIR})
 
11
        ELSE()
 
12
                # Append a few unusual default search directories for convenience
 
13
                # if no FIND ROOT PATH was specified.
 
14
                LIST(APPEND CONTRIB_DIR /opt/local /usr/local)
 
15
        ENDIF()
 
16
ENDIF()
 
17
 
 
18
 
 
19
# Append all contrib dirs to the (potentially empty) FIND_ROOT_PATH.
 
20
# This will be the final search order used by regular CMAKE modules (by default)
 
21
# and by the OpenMS macros (via CONTRIB_DIR).
 
22
LIST(APPEND CMAKE_FIND_ROOT_PATH "${CONTRIB_DIR}")
 
23
SET(TMP "")
 
24
FOREACH(CUSTOM_PATH IN ITEMS ${CMAKE_FIND_ROOT_PATH})
 
25
        GET_FILENAME_COMPONENT(ABS_PATH ${CUSTOM_PATH} ABSOLUTE)
 
26
        LIST(APPEND TMP ${ABS_PATH})
 
27
ENDFOREACH()
 
28
SET(CMAKE_FIND_ROOT_PATH "${TMP}")
 
29
SET(CONTRIB_DIR "${CMAKE_FIND_ROOT_PATH}")
 
30
 
 
31
MESSAGE(STATUS "CMake find root path: " ${CMAKE_FIND_ROOT_PATH})
 
32
 
 
33
set(CONTRIB_INCLUDE_DIR "" CACHE INTERNAL "contrib include dir")
 
34
set(CONTRIB_LIB_DIR "" CACHE INTERNAL "contrib lib dir")
 
35
foreach(CONTRIB_PATH ${CONTRIB_DIR})
 
36
  list(APPEND CONTRIB_INCLUDE_DIR "${CONTRIB_PATH}/include/")
 
37
  list(APPEND CONTRIB_LIB_DIR "${CONTRIB_PATH}/lib/")
 
38
endforeach()
 
39
message(STATUS "Contrib search directories:  ${CONTRIB_DIR}")
 
40
message(STATUS "Contrib library directories: ${CONTRIB_LIB_DIR}")
 
41
message(STATUS "Contrib include directories: ${CONTRIB_INCLUDE_DIR}")
 
42
 
 
43
###########################################################
 
44
###                                                      find libs (for linking)                                                                ###
 
45
###########################################################
 
46
## on windows we need the *.lib versions (dlls alone won't do for linking)
 
47
## On Windows: never mix Release/Debug versions of libraries. Leads to strange segfaults, stack corruption etc, due to different runtime libs ...
 
48
##             compiler-wise: use the same compiler for contrib and OpenMS!
 
49
 
 
50
#set which library extensions are preferred (we want static libraries)
 
51
if(NOT MSVC)
 
52
        set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
 
53
endif()
 
54
if (APPLE)
 
55
        set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dylib")
 
56
endif()
 
57
 
 
58
OPENMS_CHECKLIB(CONTRIB_XERCESC "xerces-c_3;xerces-c_static_3;libxerces-c;xerces-c" "xerces-c_3D;xerces-c_static_3D;libxerces-c;xerces-c" "xerces_c")
 
59
 
 
60
OPENMS_CHECKLIB(CONTRIB_GSL "gsl" "gsl_d;gsl" "GSL")
 
61
 
 
62
OPENMS_CHECKLIB(CONTRIB_GSLCBLAS "cblas;gslcblas" "cblas_d;gslcblas" "GSL-CBLAS")
 
63
 
 
64
## BOOST
 
65
#if (WIN32 OR APPLE)
 
66
        set(Boost_USE_STATIC_LIBS  ON)
 
67
#else()
 
68
#       set(Boost_USE_STATIC_LIBS  OFF)
 
69
#endif()
 
70
set(Boost_USE_MULTITHREADED  ON)
 
71
set(Boost_USE_STATIC_RUNTIME OFF)
 
72
 
 
73
FIND_PACKAGE(Boost 1.42.0 REQUIRED iostreams date_time math_c99)
 
74
if(Boost_FOUND)
 
75
        INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
 
76
  message(STATUS "Found Boost version ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" )
 
77
else()
 
78
  message(FATAL_ERROR "Boost or one of its components not found!")
 
79
endif()
 
80
 
 
81
## SEQAN
 
82
FIND_PACKAGE(SEQAN 1.3.1)
 
83
if(SEQAN_FOUND)
 
84
        INCLUDE_DIRECTORIES(${SEQAN_INCLUDE_DIRS})
 
85
  message(STATUS "Found SEQAN version ${SEQAN_VERSION_MAJOR}.${SEQAN_VERSION_MINOR}.${SEQAN_VERSION_PATCH}" )
 
86
else()
 
87
  message(FATAL_ERROR "SeqAn could not be found. Please install it from www.seqan.de or download and install the OpenMS contrib package.")
 
88
endif()
 
89
 
 
90
## libsvm
 
91
if (WIN32) ## find manually on Windows, as find_package() does not know about debug lib
 
92
        OPENMS_CHECKLIB(LIBSVM_LIBRARY "svm" "svmd;svm" "libSVM")
 
93
endif()
 
94
FIND_PACKAGE(libSVM 2.91) ## will not overwrite LIBSVM_LIBRARY if defined already
 
95
if (LIBSVM_FOUND)
 
96
        INCLUDE_DIRECTORIES(${LIBSVM_INCLUDE_DIRS})
 
97
        message(STATUS "Found LibSVM version " ${LIBSVM_VERSION})
 
98
        set(CF_OPENMS_LIBSVM_VERSION_MAJOR ${LIBSVM_MAJOR_VERSION})
 
99
        set(CF_OPENMS_LIBSVM_VERSION_MINOR ${LIBSVM_MINOR_VERSION})
 
100
        set(CF_OPENMS_LIBSVM_VERSION ${LIBSVM_VERSION})
 
101
        set(DEP_LIBSVM_LIBRARY ${LIBSVM_LIBRARY} ${LIBSVM_LIBRARIES}) # combine for consistent use later
 
102
else()
 
103
        message(FATAL_ERROR "LibSVM not found!")
 
104
endif()
 
105
 
 
106
if (${USE_COINOR}) 
 
107
        set(CF_USECOINOR 1) 
 
108
        OPENMS_CHECKLIB(CONTRIB_CBC1 "libCbc;Cbc" "libCbcd;Cbc" "COIN-OR Cbc")
 
109
        OPENMS_CHECKLIB(CONTRIB_CBC2 "libCgl;Cgl" "libCgld;Cgl" "COIN-OR Cgl")
 
110
        OPENMS_CHECKLIB(CONTRIB_CBC3 "libClp;Clp" "libClpd;Clp" "COIN-OR Clp")
 
111
        OPENMS_CHECKLIB(CONTRIB_CBC4 "libCoinUtils;CoinUtils" "libCoinUtilsd;CoinUtils" "COIN-OR Utils")
 
112
        OPENMS_CHECKLIB(CONTRIB_CBC5 "libOsi;Osi" "libOsid;Osi" "COIN-OR Osi")
 
113
        OPENMS_CHECKLIB(CONTRIB_CBC6 "libOsiClp;OsiClp" "libOsiClpd;OsiClp" "COIN-OR OsiClp")
 
114
        set(CONTRIB_CBC ${CONTRIB_CBC1} ${CONTRIB_CBC2} ${CONTRIB_CBC3} ${CONTRIB_CBC4} ${CONTRIB_CBC5} ${CONTRIB_CBC6} )
 
115
else()
 
116
        set(CF_USECOINOR 0)
 
117
        set(CONTRIB_CBC)        
 
118
endif()
 
119
 
 
120
OPENMS_CHECKLIB(CONTRIB_GLPK "glpk" "glpkd;glpk" "GLPK")
 
121
        
 
122
OPENMS_CHECKLIB(CONTRIB_ZLIB "zlib;z" "zlib_d;zlib;z" "ZLIB")
 
123
OPENMS_CHECKLIB(CONTRIB_BZIP2 "libbz2;bz2" "libbz2d;libbz2;bz2" "BZIP2")
 
124
 
 
125
if(MSVC)
 
126
        ## needed to locate libs (put this above ADD_LIBRARY() - otherwise it will not work)
 
127
        link_directories(${CONTRIB_LIB_DIR})
 
128
endif()
 
129
 
 
130
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include/)
 
131
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include/) ## for configured files, e.g. config.h
 
132
INCLUDE_DIRECTORIES(${CONTRIB_INCLUDE_DIR})
 
133
 
 
134
#except for the contrib libs, prefer shared libraries
 
135
if(NOT MSVC AND NOT APPLE)
 
136
        set(CMAKE_FIND_LIBRARY_SUFFIXES ".so;.a")
 
137
endif()
 
138
 
 
139
 
 
140
################################
 
141
## QT
 
142
################################
 
143
SET(QT_MIN_VERSION "4.5.0")
 
144
## obsolete when CMake MinRequiredVersion becomes >= 2.8.5
 
145
if ("${CMAKE_VERSION}" VERSION_LESS "2.8.5" AND NOT(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) ##
 
146
        set(phonon_extra QtPhonon)
 
147
        message(STATUS "Trying to find Phonon explicitly... If you run into trouble with Qt Phonon, try to disable it in build system")
 
148
else()
 
149
        set(phonon_extra)
 
150
        message(STATUS "Not trying to find Phonon explicitly... If you run into trouble with Qt Phonon, try to enable it in build system")
 
151
endif()
 
152
FIND_PACKAGE(Qt4 REQUIRED QtXML QtNetwork QtSQL QtOpenGL QtSVG QtTest QtWebKit ${phonon_extra})
 
153
 
 
154
IF (NOT QT4_FOUND)
 
155
  message(STATUS "QT4 not found!")
 
156
        message(FATAL_ERROR "To find a custom Qt installation use: cmake <..more options..> -D QT_QMAKE_EXECUTABLE='<path_to_qmake(.exe)' <src-dir>")
 
157
ENDIF()
 
158
INCLUDE(${QT_USE_FILE})
 
159
INCLUDE(UseQt4)
 
160
INCLUDE_DIRECTORIES(${QT_INCLUDES})
 
161
 
 
162
## FIX
 
163
## - QT4 library list (VS2010 requires semicolon separated lists, previous versions use space, thus a lib named "opengl32.lib glu32.lib gdi32.lib user32.lib delayimp.lib" now poses a problem)
 
164
## - this fix will be obsolete with CMake 2.8.1
 
165
set(QT_LIBRARIES_TMP "")
 
166
foreach (qtlib ${QT_LIBRARIES})
 
167
        if (${qtlib} STREQUAL "opengl32.lib glu32.lib gdi32.lib user32.lib delayimp.lib")
 
168
                list(APPEND QT_LIBRARIES_TMP "opengl32.lib;glu32.lib;gdi32.lib;user32.lib;delayimp.lib")
 
169
                message(STATUS "Fixing QT library list... done")
 
170
        else()
 
171
                list(APPEND QT_LIBRARIES_TMP ${qtlib})
 
172
        endif()
 
173
endforeach()
 
174
set(QT_LIBRARIES ${QT_LIBRARIES_TMP})
 
175
## ENDFIX
 
176
 
 
177
MESSAGE(STATUS "QT qmake at ${QT_QMAKE_EXECUTABLE}")
 
178
MESSAGE(STATUS "QT moc at ${QT_MOC_EXECUTABLE}")
 
179
MESSAGE(STATUS "QT uic at ${QT_UIC_EXECUTABLE}")
 
180
MESSAGE(STATUS "QT includes at ${QT_INCLUDES}")
 
181
MESSAGE(STATUS "QT libraries at ${QT_LIBRARIES}")