70 |
70 |
71 |
71 |
72 #perform safe check that enable/disable compilation features |
72 #perform safe check that enable/disable compilation features |
73 include(${CMAKE_MODULE_PATH}/compilerchecks.cmake) |
73 include(${CMAKE_MODULE_PATH}/compilerchecks.cmake) |
74 |
74 |
75 #set default flags values for all projects (unless MINIMAL_FLAGS is true) |
75 #set default compiler flags |
76 if(NOT ${MINIMAL_FLAGS}) |
76 add_flag_append(CMAKE_C_FLAGS "-Wall -pipe") |
77 set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}") |
77 add_flag_append(CMAKE_C_FLAGS_RELEASE "-Os") |
78 set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}") |
78 add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0") |
79 set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g ${CMAKE_C_FLAGS_DEBUG}") |
79 add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe") |
80 set(CMAKE_CXX_FLAGS "-pipe ${CMAKE_CXX_FLAGS}") |
80 add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-Os") |
81 set(CMAKE_CXX_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_CXX_FLAGS_RELEASE}") |
81 add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0") |
82 set(CMAKE_CXX_FLAGS_DEBUG "-Wall -O0 -g ${CMAKE_CXX_FLAGS_DEBUG}") |
82 add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000") |
83 else() |
83 add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv") |
84 #CMake adds a lot of additional configuration flags, so let's clear them up |
84 add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs") |
85 set(CMAKE_C_FLAGS_RELEASE "") |
85 |
86 set(CMAKE_C_FLAGS_DEBUG "-Wall") |
86 #CMake adds a lot of additional configuration flags, so let's clear them up |
87 set(CMAKE_CXX_FLAGS_RELEASE "") |
87 if(${MINIMAL_FLAGS}) |
88 set(CMAKE_CXX_FLAGS_DEBUG "-Wall") |
88 unset(CMAKE_C_FLAGS_RELEASE) |
|
89 unset(CMAKE_C_FLAGS_DEBUG) |
|
90 unset(CMAKE_CXX_FLAGS_RELEASE) |
|
91 unset(CMAKE_CXX_FLAGS_DEBUG) |
89 endif() |
92 endif() |
90 |
93 |
91 |
94 |
92 #parse additional parameters |
95 #parse additional parameters |
93 if(FPFLAGS) |
96 if(FPFLAGS) |
94 add_flag_prepend(CMAKE_Pascal_FLAGS ${FPFLAGS}) |
97 add_flag_prepend(CMAKE_Pascal_FLAGS ${FPFLAGS}) |
95 endif() |
98 endif() |
96 if(GHFLAGS) |
99 if(GHFLAGS) |
97 if(${allow_parse_args}) |
100 if(${CMAKE_VERSION} VERSION_GREATER 2.6) |
98 separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS}) |
101 separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS}) |
99 else() |
102 else() |
100 message(${WARNING} "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8") |
103 message(${WARNING} "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8") |
101 endif() |
104 endif() |
102 endif() |
105 endif() |
103 |
106 |
104 |
107 list(APPEND haskell_flags ${ghflags_parsed} "-O2") |
105 list(APPEND haskell_flags ${ghflags_parsed} # user flags |
|
106 "-O2" # optimise for faster code |
|
107 ) |
|
108 |
|
109 #-vm4079,4080,4081 |
|
110 add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000") |
|
111 add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv") |
|
112 add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs") |
|
113 |
108 |
114 #get BUILD_TYPE and enable/disable optimisation |
109 #get BUILD_TYPE and enable/disable optimisation |
115 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration") |
110 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration") |
116 if(CMAKE_BUILD_TYPE MATCHES "DEBUG") |
111 if(CMAKE_BUILD_TYPE MATCHES "DEBUG") |
117 list(APPEND haskell_flags "-Wall" # all warnings |
112 list(APPEND haskell_flags "-Wall" # all warnings |