1 | |
---|
2 | # project options |
---|
3 | |
---|
4 | option( MADX_STATIC "Turn on for static linking" OFF) |
---|
5 | option( MADX_DEBUG "Turn on debug output" OFF) |
---|
6 | |
---|
7 | # We need to specify what kind of library suffixes we search for in case |
---|
8 | # for static linking: |
---|
9 | if(MADX_STATIC) |
---|
10 | if(WIN32) |
---|
11 | set(CMAKE_FIND_LIBRARY_SUFFIXES .lib) |
---|
12 | elseif(APPLE) |
---|
13 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib) |
---|
14 | else() |
---|
15 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a) |
---|
16 | endif() |
---|
17 | if(BUILD_SHARED_LIBS) |
---|
18 | message(FATAL_ERROR "Cannot build shared libs with MADX_STATIC on") |
---|
19 | endif() |
---|
20 | endif() |
---|
21 | |
---|
22 | #Mad-X specific options (arch. specific options can be added in similar manner): |
---|
23 | option( MADX_NTPSA "Build with NTPSA" ON) |
---|
24 | option( MADX_FORCE_32 "Force 32bit build" OFF ) |
---|
25 | if(APPLE) |
---|
26 | option( MADX_BUNDLE "Create bundle on OSX" OFF) |
---|
27 | endif() |
---|
28 | |
---|
29 | # double logic: first we set madx_online default on if sdds is found |
---|
30 | # then if MADX_ONLINE is on without sdds found, we throw fatal error. |
---|
31 | |
---|
32 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
---|
33 | #include our specific folders: |
---|
34 | if( MADX_FORCE_32 OR ${CMAKE_SIZEOF_VOID_P} EQUAL 4 ) |
---|
35 | set(SDDS_SEARCH_DIRS ${CMAKE_SOURCE_DIR}/lib32/) |
---|
36 | else() |
---|
37 | set(SDDS_SEARCH_DIRS ${CMAKE_SOURCE_DIR}/lib64/) |
---|
38 | endif() |
---|
39 | endif() |
---|
40 | # normal search: |
---|
41 | find_package(SDDS) |
---|
42 | |
---|
43 | if(SDDS_FOUND) |
---|
44 | option( MADX_ONLINE "Build with Online model" ON) |
---|
45 | else() |
---|
46 | option( MADX_ONLINE "Build with Online model" OFF) |
---|
47 | endif() |
---|
48 | if(MADX_ONLINE AND NOT SDDS_FOUND) |
---|
49 | message(FATAL_ERROR "SDDS is not found, required for the online model!") |
---|
50 | endif() |
---|
51 | |
---|
52 | # Default build type (defines different sets of flags) |
---|
53 | if(NOT CMAKE_BUILD_TYPE) |
---|
54 | set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING |
---|
55 | "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." |
---|
56 | FORCE) |
---|
57 | endif() |
---|
58 | |
---|
59 | if(MADX_NTPSA) |
---|
60 | add_definitions("-D_NTPSA") |
---|
61 | endif() |
---|