source: PSPA/madxPSPA/src/CMakeLists.txt @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 3.0 KB
Line 
1
2# We want to run coverage analysis of
3# the files compiled here..
4include(buildtypeCoverage)
5
6# list of source files
7file(GLOB src_files
8   mad_*.c
9   *.f90
10   *.F90
11   *.cpp)
12file(GLOB main_file mad_main.c)
13if(WIN32 OR CYGWIN)
14   file(GLOB gxx_remove gxx11c.c gxx11.f90)
15else()
16   file(GLOB gxx_remove gxx11psc.c gxx11ps.f90)
17endif()
18
19# Some source files which should not be included:
20file(GLOB sdds_remove matchsdds.c)
21
22if(NOT MADX_FORCE_32)
23   # find laplas and blas
24   find_package(LAPACK)
25endif()
26
27if(LAPACK_FOUND AND BLAS_FOUND)
28   message(STATUS "LAPACK uses ${LAPACK_LIBRARIES}")
29   file(GLOB lapack_remove matchlib.f90 matchlib2.f90)
30else()
31   # Note, this only APPENDS -O0 to the compile flags, same as Makefile currently does.
32   set_source_files_properties(matchlib2.f90 PROPERTIES COMPILE_FLAGS "-O0")
33endif()
34
35# remove source files according to NTPSA option...
36if(MADX_NTPSA)
37   message(STATUS "NTPSA turned on")
38   file(GLOB ntpsa_remove c_dabnew.f90)
39else()
40   file(GLOB ntpsa_remove c_dabnew_berz.f90 c_tpsa_interface.f90 tpsa.cpp)
41endif()
42
43set(remove_list ${gxx_remove} ${sdds_remove} ${ntpsa_remove} ${lapack_remove})
44list(REMOVE_ITEM src_files ${remove_list})
45
46# header files...
47file(GLOB headerfiles *.h)
48
49# adding library:
50add_library(madx ${src_files})
51
52target_link_libraries(madx ptc)
53
54
55# not sure if this is needed...
56set_target_properties(madx PROPERTIES LINKER_LANGUAGE Fortran)
57
58# set library version:
59set_target_properties(madx     PROPERTIES VERSION ${MADX_VERSION} SOVERSION 1)
60
61# adding an executable:
62if(MADX_BUNDLE)
63   add_executable(madxbin MACOSX_BUNDLE  ${main_file})
64else()
65   add_executable(madxbin ${main_file})
66endif()
67set_target_properties(madxbin PROPERTIES LINKER_LANGUAGE Fortran VERSION ${MADX_VERSION})
68
69# we want to add _dev to the binary in case this is a dev version for the automatic packaging...
70set_target_properties(madxbin PROPERTIES OUTPUT_NAME "madx${BINARY_POSTFIX}")
71
72# we need to link executable to our own library:
73target_link_libraries(madxbin madx)
74
75# I turn off search for libraries in case you are on Linux,
76# to make sure we make use of the lib/lib64 folders
77if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
78   #necessary to search for X11 for OSX instead of directly including it
79   find_package(X11)
80   if(X11_FOUND)
81      include_directories(${X11_INCLUDE_DIR})
82      target_link_libraries(madx ${X11_X11_LIB})
83   endif()
84else()
85   target_link_libraries(madx X11)
86endif()
87
88if(LAPACK_FOUND AND BLAS_FOUND)
89   target_link_libraries(madx ${LAPACK_LIBRARIES})
90endif()
91
92# Online libraries:
93if(MADX_ONLINE)
94   target_link_libraries(madx ${SDDS_LIBRARIES})
95endif()
96if(NOT WIN32)
97   target_link_libraries(madx z)
98endif()
99
100find_package(Threads)
101find_package(STDCPP)
102target_link_libraries(madx  ${CMAKE_THREAD_LIBS_INIT} ${STDCPP_LIBS})
103
104# Defining specific stuff for packaging:
105# Should be called after sources are defined,
106# before targets are defined.
107include(setupPackaging)
108
109#
110# we call a subscript that sets up installation stuff:
111#
112# Should be called after targets are defined
113#
114include(setupInstallation)
Note: See TracBrowser for help on using the repository browser.