source: trunk/CMakeLists.txt @ 2296

Last change on this file since 2296 was 2296, checked in by Takeshi Nakazato, 13 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: Introduced CMAKE_BUILD_TYPE option

Test Programs: build asap

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Introduced CMAKE_BUILD_TYPE option in cmaking.
Options are: Release, Debug, RelWithDebInfo?, MinSizeRel?, Profile.
Default is RelWithDebInfo?.


File size: 18.6 KB
Line 
1###
2# CMakeLists.txt for ASAP module
3###
4
5# minimum requirement for cmake version
6cmake_minimum_required( VERSION 2.8 )
7
8# options
9option( USE_LIBCASACORE
10        "set ON to use libcasacore.so instead of libcasa_*.so"
11        OFF )
12option( STANDALONE
13        "set ON to build standalone mode"
14        OFF )
15message( STATUS "USE_LIBCASACORE = " ${USE_LIBCASACORE} )
16message( STATUS "STANDALONE = " ${STANDALONE} )
17
18# Define compiler paths on OSX 10.5. This must be done before invoking project()
19if( APPLE )
20    if( EXISTS            /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
21        set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
22        set( CMAKE_CXX_COMPILER     /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )
23    elseif( EXISTS        /opt/local/bin/gfortran )
24        set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )
25    elseif( EXISTS        /opt/local/bin/gfortran-mp-4.4 )
26        set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )
27        if( EXISTS /opt/local/bin/g++-mp-4.4 )
28            set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )
29        endif()
30    endif()
31endif()
32
33
34# project name is ASAP
35project( ASAP )
36
37
38#
39# build type and their flags
40#
41# CMAKE_BUILD_TYPE (Release, Debug, RelWithDebInfo, MinSizeRel, Profile)
42# default is RelWithDebInfo
43#
44if ( NOT CMAKE_BUILD_TYPE )
45   set( CMAKE_BUILD_TYPE RelWithDebInfo )
46endif()
47message( STATUS "CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE} )
48
49# flags for Debug build
50if ( CMAKE_BUILD_TYPE STREQUAL Debug )
51   add_definitions( -DAIPS_DEBUG )
52endif()
53set( CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0 -fno-omit-frame-pointer" )
54
55# flags for Profile build
56set( CMAKE_CXX_FLAGS_PROFILE "-g -O2 -pg -fprofile-arcs -fno-omit-frame-pointer" )
57
58# flags for Release build
59set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wl,-s" )
60
61# flags for MinSizeRel build
62set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Wl,-s" )
63
64# default flags
65set( DEFAULT_CXX_FLAGS
66     "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" )
67
68find_package( OpenMP )
69if( OPENMP_FOUND )
70   set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
71endif()
72
73# environment dependent settings
74message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )
75message( STATUS "CMAKE_SYSTEM_PROCESSOR = " ${CMAKE_SYSTEM_PROCESSOR} )
76if( APPLE )
77   set( SO dylib )
78   if( CMAKE_SYSTEM MATCHES ^Darwin-10 )
79      if( NOT archflag )
80         if( EXISTS /opt/casa/darwin10-64b )
81            set( archflag x86_64 )
82         elseif( EXISTS /opt/casa/core2-apple-darwin10 )
83            set( archflag i386 )
84         else()
85            set( archflag x86_64 )
86         endif()
87      endif()
88      if( archflag STREQUAL x86_64 )
89         add_definitions( -DAIPS_64B )
90      endif()
91      execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version
92                       COMMAND head -1
93                       COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"
94                       OUTPUT_VARIABLE _cxx_version
95                       OUTPUT_STRIP_TRAILING_WHITESPACE )
96      if( NOT _cxx_version STREQUAL "4.4" )
97         set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )
98      endif()
99   endif()         
100elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
101   set( SO so )
102   add_definitions( -DAIPS_LINUX )
103   if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
104      add_definitions( -DAIPS_64B )
105      set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )
106   else()
107      set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )
108   endif()
109endif()
110
111# set flags for cpp compiler
112set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
113
114
115#
116# casacore definitions
117#
118set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
119  -DCASA_USECASAPATH
120  -DCASACORE_NEEDS_RETHROW
121  -DAIPS_STDLIB
122  -DAIPS_AUTO_STL
123  -D_GNU_SOURCE )
124
125if( CMAKE_SYSTEM_NAME STREQUAL Linux )
126  set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
127    -D_FILE_OFFSET_BITS=64
128    -D_LARGEFILE_SOURCE
129    )
130endif()
131
132add_definitions( ${CASACORE_DEFINITIONS} )
133
134
135#
136# mode specific settings
137#
138# STANDALONE=ON   standalone build
139# STANDALONE=OFF  build with casa
140#
141set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake" )
142message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
143if( STANDALONE )
144   include( standalone )
145else()
146   include( withcasa )
147endif()
148
149message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )
150
151
152#
153# casacore
154#
155unset( CASACORE_INCLUDE_DIR CACHE )
156unset( CASACORE_LIBRARIES CACHE )
157if( NOT USE_LIBCASACORE )
158   # use casacore libraries
159   set( _includename casa/aipsdef.h )
160   find_path( CASACORE_INCLUDE_DIR ${_includename}
161              PATHS ${CASACORE_PATHS}
162              PATH_SUFFIXES include include/casacore
163              NO_DEFAULT_PATH )
164   find_path( CASACORE_INCLUDE_DIR ${_includename} )
165   if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
166     message( FATAL_ERROR "${_includename} could not be found. Please check!" )
167   endif()
168   set( CASACORE_LIBS casa
169                      components
170                      coordinates
171                      fits
172                      images
173                      lattices
174                      measures
175                      mirlib
176                      ms
177                      msfits
178                      scimath
179                      scimath_f
180                      tables )
181   set( _casacore_libs "" )
182   foreach( _a ${CASACORE_LIBS} )
183      set( _libname libcasa_${_a}.${SO} )
184      unset( _casacore_lib CACHE )
185      find_library( _casacore_lib ${_libname}
186                    PATHS ${CASACORE_PATHS}
187                    PATH_SUFFIXES lib64 lib )
188      if( _casacore_lib MATCHES "NOTFOUND$" )
189         message( FATAL_ERROR "${_libname} could not be found. Please check!" )
190      else()
191         #list( APPEND _casacore_libs casa_${_a} )
192         list( APPEND _casacore_libs ${_casacore_lib} )
193      endif()
194   endforeach()
195   set( CASACORE_LIBRARIES ${_casacore_libs} )
196else()
197   # use libcasacore
198   set( _libname libcasacore.${SO} )
199   find_library( CASACORE_LIBRARIES ${_libname}
200                 PATHS ${CASACORE_PATHS}
201                 PATH_SUFFIXES lib64 lib )
202   if( CASACORE_LIBRARIES MATCHES "NOTFOUND$" )
203      message( FATAL_ERROR "${_libname} could not be found. Please check!" )
204   endif()
205   set( _includename casa/aipsdef.h )
206   string( REGEX REPLACE /[^/]+/[^/]+/?$ "" _coreroot ${CASACORE_LIBRARIES} )
207   find_path( CASACORE_INCLUDE_DIR ${_includename}
208              PATHS ${_coreroot}
209              PATH_SUFFIXES include include/casacore
210              NO_DEFAULT_PATH )
211   find_path( CASACORE_INCLUDE_DIR ${_includename}
212              PATHS ${CASACORE_PATHS}
213              PATH_SUFFIXES include include/casacore
214              NO_DEFAULT_PATH )
215   find_path( CASACORE_INCLUDE_DIR ${_includename} )
216   if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
217     message( FATAL_ERROR "${_includename} could not be found. Please check!" )
218   endif()
219endif()
220message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} )
221message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} )
222unset( USE_LIBCASACORE CACHE )
223
224
225#
226# Python
227#
228if( STANDALONE )
229   include( FindPythonLibs )
230   if( NOT PYTHONLIBS_FOUND )
231      message( FATAL_ERROR "Python could not be found. Please check!" )
232   endif()
233
234   # Define pyroot
235   string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_INCLUDE_DIRS} )
236
237   # find numpy
238   string( REGEX MATCH [0-9].[0-9] PYTHONV ${PYTHON_INCLUDE_DIRS} )
239   string( REPLACE "." "" PV ${PYTHONV} )
240   find_path( NUMPY_INCLUDE_DIR numpy/npy_interrupt.h
241              PATHS
242                 ${pyroot}/lib/python${PYTHONV}/site-packages/numpy/core
243                 ${pyroot}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
244                 ${pyroot}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
245              PATH_SUFFIXES include )
246   if( NUMPY_INCLUDE_DIR MATCHES "NOTFOUND$" )
247      message( FATAL_ERROR "numpy/npy_interrupt.h could not be found. Please check!" )
248   endif()
249   list( APPEND PYTHON_INCLUDE_DIRS ${NUMPY_INCLUDE_DIR} )
250
251   set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
252      -DPYTHONROOT=\"${pyroot}\"
253      -DPYTHONVER=\"${PYTHONV}\"
254      -DPYVERSION=${PV} )
255else()
256   if( NOT PYTHON_FOUND )
257      if ( NOT PYTHON_LIBNAME )
258         set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 )
259         # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.)
260      else()
261         set( _names ${PYTHON_LIBNAME} )
262      endif()
263
264      set( _found False )
265      foreach( _v ${_names} )
266
267         casa_find(
268            PYTHON${_v}
269            LIBS python${_v}
270            NO_REQUIRE
271         )
272
273         if( PYTHON${_v}_FOUND )
274            set( PYTHON_LIBNAME ${_v} )
275            set( _found True )
276            break()
277         endif()
278
279      endforeach()
280 
281      if( NOT _found )
282         message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" )
283      endif()
284
285   endif()
286
287   if( NOT PYTHON_LIBNAME )
288      # Found Python, but PYTHON_LIBNAME is undefined, that is impossible.
289      message( FATAL_ERROR "The variable PYTHON_LIBNAME is undefined. Most likely, CMake's cache is out of date and you need to redetect your PYTHON installation (\"cmake -U PYTHON*\")")
290   endif()
291
292   string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV )
293   string( REPLACE "." "" PV ${PYTHONV} )
294   set( python_library python${PYTHON_LIBNAME} )
295
296   # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from
297   # the full python library path
298   string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
299   if( _match )
300      string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
301   else()
302      # Python library was not in a lib(64) directory!
303      message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" )
304      set( python_prefix ${casa_packages} )
305   endif()
306
307   # The python version and prefix is known, do the actual search
308   if( NOT PYTHON_FOUND )
309      message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" )
310   endif()
311
312   casa_find( PYTHON
313      VERSION 2.5    # minimum required
314      INCLUDES Python.h
315         numpy/npy_interrupt.h   # for numpy
316      INCLUDES_SUFFIXES python${PYTHONV}
317      PREFIX_HINTS
318         ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core
319         ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
320         ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
321      LIBS ${python_library}
322      CPP_VERSION PY_VERSION )
323
324   # Store PYTHON_LIBNAME in the cache
325   set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE )
326
327   # Define pyroot to two directory levels above Python.h.
328   string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} )
329
330   set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
331      -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\"
332      -DAIPSARCH=\"${arch}\"
333      -DAIPSSITE=\"garching\"
334      -DPYTHONROOT=\"${pyroot}\"
335      -DPYTHONVER=\"${PYTHONV}\"
336      -DPYVERSION=${PV} )
337endif()
338message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} )
339message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} )
340message( STATUS "PYTHONV = " ${PYTHONV} )
341
342
343#
344# DL
345#
346set( DL_LIBRARIES ${CMAKE_DL_LIBS} CACHE STRING "dl libraries" FORCE )
347if( DL_LIBRARIES STREQUAL "dl" )
348  set( DL_LIBRARIES "-ldl" CACHE STRING "dl libraries" FORCE )
349endif()
350message( STATUS "DL_LIBRARIES = " ${DL_LIBRARIES} )
351
352
353#
354# BLAS
355#
356find_library( BLAS_LIBRARIES libblas.${SO} )
357if ( BLAS_LIBRARIES MATCHES "NOTFOUND$" )
358   message( FATAL_ERROR "blas could not be found. Please check!" )
359endif()
360message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )
361
362
363#
364# LAPACK
365#
366find_library( LAPACK_LIBRARIES liblapack.${SO} )
367if ( LAPACK_LIBRARIES MATCHES "NOTFOUND$" )
368   message( FATAL_ERROR "lapack could not be found. Please check!" )
369endif()
370message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )
371
372
373#
374# Boost
375#
376set( boost_components python )
377if( NOT STANDALONE )
378  set( boost_components ${boost_components} system )
379endif()
380find_package( Boost REQUIRED ${boost_components} )
381if( NOT Boost_FOUND )
382  message( FATAL_ERROR "Boost could not be found. Please check!" )
383endif()
384message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )
385message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} )
386
387
388#
389# cfitsio
390#
391if( STANDALONE )
392   find_path( CFITSIO_INCLUDE_DIRS fitsio.h
393              PATH_SUFFIXES cfitsio )
394   if( CFITSIO_INCLUDE_DIRS MATCHES "NOTFOUND$" )
395      message( FATAL_ERROR "fitsio.h could not be found. Please check!" )
396   endif()
397   string( REGEX REPLACE "/[^/]+/?$" "" CFITSIO_ROOT ${CFITSIO_INCLUDE_DIRS} )
398   message( STATUS "CFITSIO_ROOT=" ${CFITSIO_ROOT} )
399   find_library( CFITSIO_LIBRARIES libcfitsio.${SO}
400                 PATHS ${CFITSIO_ROOT}
401                 PATH_SUFFIXES lib64 lib
402                 NO_DEFAULT_PATH )
403   if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" )
404      find_library( CFITSIO_LIBRARIES libcfitsio.a
405                    PATHS ${CFITSIO_ROOT}
406                    PATH_SUFFIXES lib64 lib
407                    NO_DEFAULT_PATH )
408   endif()
409   find_library( CFITSIO_LIBRARIES libcfitsio.${SO}
410                 PATHS /usr/local /usr
411                 PATH_SUFFIXES lib64 lib )
412   if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" )
413      message( FATAL_ERROR "libcfitsio.so could not be found. Please check!" )
414   endif()
415else()
416   casa_find( CFITSIO
417              VERSION 3.006
418              INCLUDES fitsio.h fitsio2.h
419              INCLUDES_SUFFIXES cfitsio
420              LIBS cfitsio
421              CPP_VERSION CFITSIO_VERSION
422              RUN_VERSION "(ffvers(&v), v)" )
423endif()
424message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} )
425message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} )
426
427
428#
429# Fortran
430#
431if( NOT FORTRAN_LIBRARIES )
432
433  message( STATUS "Looking for Fortran runtime libraries" )
434  set( _try  ${CMAKE_BINARY_DIR}/try_fortran.cc )
435  file( WRITE ${_try}
436    "int main() { return 0; }\n"
437    )
438 
439  if( _gfortran_lib_path )
440    try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
441      CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"
442      )
443  else()
444    try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
445      CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"
446      )
447  endif()
448  try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}
449    CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"
450    )
451 
452  if( _have_gfortran )
453    if( _gfortran_lib_path )
454      set( FORTRAN_LIBRARIES ${_gfortran_lib_path}
455        CACHE STRING "Fortran library linker option" FORCE )
456    else()
457      set( FORTRAN_LIBRARIES -lgfortran
458        CACHE STRING "Fortran library linker option" FORCE )
459    endif()
460    message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
461  elseif( _have_g2c )
462    set( FORTRAN_LIBRARIES -lg2c
463      CACHE STRING "Fortran library linker option" FORCE )
464    message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
465  else()
466    set( FORTRAN_LIBRARIES ""
467      CACHE STRING "Fortran library linker option" FORCE )
468    message( STATUS "Looking for Fortran runtime libraries -- <none>" )
469    # Not a fatal error because it might work, if all Fortran dependencies were
470    # already linked statically to the Fortran runtime...
471  endif()
472endif()
473
474
475#
476# RPFITS
477#
478if ( STANDALONE )
479   find_path( RPFITS_INCLUDE_DIRS RPFITS.h
480              PATHS /usr/local /usr
481              PATH_SUFFIXES include )
482   if( RPFITS_INCLUDE_DIRS MATCHES "NOTFOUND$" )
483      message( FATAL_ERROR "RPFITS.h could not be found. Please check!" )
484   endif()
485   find_library( RPFITS_LIBRARIES librpfits.so
486                 PATHS /usr/local /usr
487                 PATH_SUFFIXES lib64 lib )
488   if( RPFITS_LIBRARIES MATCHES "NOTFOUND$" )
489      message( FATAL_ERROR "librpfits.so could not be found. Please check!" )
490   endif()
491   list( APPEND RPFITS_LIBRARIES ${FORTRAN_LIBRARIES} )
492else()
493   casa_find( RPFITS
494              VERSION 2.11
495              INCLUDES RPFITS.h
496              LIBS rpfits
497              RUN_VERSION names_.rpfitsversion
498              DEPENDS FORTRAN )
499endif()
500message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )
501message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )
502
503
504#
505# wcslib
506#
507set( _wcslib libwcs.${SO} )
508set( _wcs_version 4.3 )
509find_library( WCSLIB ${_wcslib}
510              PATHS ${WCSLIB_PATHS}
511              PATH_SUFFIXES lib64 lib )
512if( WCSLIB MATCHES "NOTFOUND$" )
513   message( STATUS "${_wcslib} could not be found." )
514   unset( _wcslib CACHE )
515   unset( WCSLIB CACHE )
516   set( _wcslib libwcs.${_wcs_version}.${SO} )
517   message( STATUS "Try to find ${_wcslib}..." )
518   find_library( WCSLIB ${_wcslib}
519                 PATHS ${WCSLIB_PATHS}
520                 PATH_SUFFIXES lib64 lib )
521   if( WCSLIB MATCHES "NOTFOUND$" )
522      message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
523   endif()
524endif()
525message( STATUS "WCSLIB = " ${WCSLIB} )
526find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h
527           PATHS ${WCSLIB_PATHS}
528           PATH_SUFFIXES include )
529if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" )
530   message( FATAL_ERROR "wcs.h could not be found. Please check!" )
531endif()
532message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} )
533
534
535#
536# common include path
537#
538include_directories( ${CASACORE_INCLUDE_DIR}
539                     ${Boost_INCLUDE_DIR}
540                     ${PYTHON_INCLUDE_DIRS}
541                     ${WCSLIB_INCLUDE_DIR}
542                     ${CFITSIO_INCLUDE_DIRS}
543                     ${RPFITS_INCLUDE_DIRS} )
544
545
546#
547# install directory
548#
549set( EXEC_INSTALL_DIR bin )
550set( LIB_INSTALL_DIR lib )
551set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap )
552set( SHARED_INSTALL_DIR share/asap )
553
554#
555# execute getsvnrev.sh to create/update svninfo.txt
556# run chmod to make sure the script has executable
557#
558exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/getsvnrev.sh )
559exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh )
560exec_program( ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh ARGS ${ASAP_SOURCE_DIR})
561
562# Add the modules to be built.
563#
564# Choose to have correct RPATHs both in the build tree and
565# in the install tree (at the cost of having to change the
566# rpath when installing)
567#
568set( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib )
569set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
570set( CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib )
571
572
573
574#
575# libraries and executables
576#
577set( ASAPLIB asap )
578set( PYRAPLIB pyrap )
579set( ATNFLIB atnf )
580set( ASAP2TO3 asap2to3 )
581if ( NOT STANDALONE )
582   set( ASDM2ASAP_OLD oldasdm2ASAP )
583   set( ASDM2ASAP asdm2ASAP )
584endif()
585
586#
587# always install by default
588#
589add_custom_target( inst ALL ${CMAKE_BUILD_TOOL} install/fast )
590
591#
592# subdirectories
593#
594asap_add_subdirectory()
Note: See TracBrowser for help on using the repository browser.