]> git.lyx.org Git - features.git/blob - development/cmake/modules/LyXMacros.cmake
3a794240495016668cfb51612dfb45d633cb1448
[features.git] / development / cmake / modules / LyXMacros.cmake
1 #
2 #  Copyright (c) 2006-2011 Peter Kümmel, <syntheticpp@gmx.net>
3 #
4 #  Redistribution and use in source and binary forms, with or without
5 #  modification, are permitted provided that the following conditions
6 #  are met:
7 #
8 #  1. Redistributions of source code must retain the copyright
9 #         notice, this list of conditions and the following disclaimer.
10 #  2. Redistributions in binary form must reproduce the copyright
11 #         notice, this list of conditions and the following disclaimer in the
12 #         documentation and/or other materials provided with the distribution.
13 #  3. The name of the author may not be used to endorse or promote products
14 #         derived from this software without specific prior written permission.
15 #
16 #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 #  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 #  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 #  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 #  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 #  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 #  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 #  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 #  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 #  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #
27
28 include (MacroAddFileDependencies)
29
30 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
31
32 macro(lyx_add_path _list _prefix)
33         set(_tmp)
34         foreach(_current ${${_list}})
35                 set(_tmp ${_tmp} ${_prefix}/${_current})
36         endforeach(_current)
37         set(${_list} ${_tmp})
38 endmacro(lyx_add_path _out _prefix)
39
40
41 #create the implementation files from the ui files and add them
42 #to the list of sources
43 #usage: LYX_ADD_UI_FILES(foo_SRCS ${ui_files})
44 macro(LYX_ADD_UI_FILES _sources _ui_files)
45         set(uifiles})
46         foreach (_current_FILE ${ARGN})
47                 get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
48                 get_filename_component(_basename ${_tmp_FILE} NAME_WE)
49                 set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h)
50
51                 # we need to run uic and replace some things in the generated file
52                 # this is done by executing the cmake script LyXuic.cmake
53                 # ######
54                 # Latest test showed on linux and windows show no bad consequeces,
55                 # so we removed the call to LyXuic.cmake
56                 qt_wrap_uifiles(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_)
57                 list(APPEND uifiles ${_header})
58         endforeach()
59         set(${_ui_files} ${uifiles})
60 endmacro(LYX_ADD_UI_FILES)
61
62
63
64 macro(LYX_AUTOMOC)
65         if (QT4_GET_MOC_INC_DIRS)
66                 QT4_GET_MOC_INC_DIRS(_moc_INCS)
67         endif()
68
69         set(_matching_FILES)
70         foreach (_current_FILE ${ARGN})
71
72                 get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
73                 # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
74                 # here. this is required to make bouic work correctly:
75                 # we need to add generated .cpp files to the sources (to compile them),
76                 # but we cannot let automoc handle them, as the .cpp files don't exist yet when
77                 # cmake is run for the very first time on them -> however the .cpp files might
78                 # exist at a later run. at that time we need to skip them, so that we don't add two
79                 # different rules for the same moc file
80                 get_source_file_property(_skip ${_abs_FILE} SKIP_AUTOMOC)
81
82                 if (EXISTS ${_abs_FILE} AND NOT _skip)
83
84                         file(READ ${_abs_FILE} _contents)
85
86                         get_filename_component(_abs_PATH ${_abs_FILE} PATH)
87
88                         string(REGEX MATCHALL "#include +[\"<]moc_[^ ]+\\.cpp[\">]" _match "${_contents}")
89                         if (_match)
90                                 foreach (_current_MOC_INC ${_match})
91                                         string(REGEX MATCH "moc_[^ <\"]+\\.cpp" _current_MOC "${_current_MOC_INC}")
92
93                                         get_filename_component(_basename ${_current_MOC} NAME_WE)
94
95                                         string(LENGTH ${_basename} _length)
96                                         MATH(EXPR _mocless_length ${_length}-4)
97                                         STRING(SUBSTRING  ${_basename} 4 ${_mocless_length} _mocless_name )
98
99                                         set(_header ${_abs_PATH}/${_mocless_name}.h)
100
101                                         #message(STATUS "moc : ${_header}")
102                                         #set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
103                                         #set(_header ${_abs_PATH}/${_basename}.h)
104
105                                         set(_moc  ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
106                                         if (WIN32)
107                                                 set(_def -D_WIN32)
108                                         else()
109                                                 set(_def)
110                                         endif()
111                                         #set(_moc ${_abs_PATH}/${_current_MOC})
112                                         add_custom_command(OUTPUT ${_moc}
113                                                           COMMAND ${QT_MOC_EXECUTABLE}
114                                                           ARGS "-DQT_VERSION=${QT4_VERSION}" ${_def} ${_moc_INCS} ${_header} -o ${_moc}
115                                                           MAIN_DEPENDENCY ${_header})
116                                         macro_add_file_dependencies(${_abs_FILE} ${_moc})
117                                         SET_SOURCE_FILES_PROPERTIES(${_moc} GENERATED)
118                                 endforeach (_current_MOC_INC)
119                         else()
120                                 #message(STATUS "moc not found : ${_abs_FILE} ")
121                         endif()
122                 endif()
123         endforeach (_current_FILE)
124 endmacro (LYX_AUTOMOC)
125
126
127 macro(lyx_const_touched_files _allinone_name _list)
128         set(_file_list ${_allinone_name}_files)
129         set(_file_const ${CMAKE_CURRENT_BINARY_DIR}/${_allinone_name}_const.C)
130         set(_file_touched ${CMAKE_CURRENT_BINARY_DIR}/${_allinone_name}_touched.C)
131
132         # don't touch exisiting or non-empty file,
133         # so a cmake re-run doesn't touch all created files
134         set(_rebuild_file_const 0)
135         if (NOT EXISTS ${_file_const})
136                 set(_rebuild_file_const 1)
137         else()
138                 FILE(READ ${_file_const} _file_content)
139                 if (NOT _file_content)
140                         set(_rebuild_file_const 1)
141                 endif()
142         endif()
143
144         set(_rebuild_file_touched 0)
145         if (NOT EXISTS ${_file_touched})
146                 set(_rebuild_file_touched 1)
147         else()
148                 FILE(READ ${_file_touched} _file_content)
149                 if (NOT _file_content)
150                         set(_rebuild_file_touched 1)
151                 endif()
152         endif()
153
154         if (LYX_MERGE_REBUILD)
155                 #message(STATUS "Merge files build: rebuilding generated files")
156                 set(_rebuild_file_const 1)
157                 set(_rebuild_file_touched 1)
158         endif()
159
160         if (_rebuild_file_const)
161                 file(WRITE  ${_file_const} "// autogenerated file \n//\n")
162                 file(APPEND ${_file_const} "//   * clear or delete this file to build it again by cmake \n//\n\n")
163         endif()
164
165         if (_rebuild_file_touched)
166                 file(WRITE  ${_file_touched} "// autogenerated file \n//\n")
167                 file(APPEND ${_file_touched} "//         * clear or delete this file to build it again by cmake \n//\n")
168                 file(APPEND ${_file_touched} "//         * don't touch this file \n//\n\n")
169                 file(APPEND ${_file_touched} "#define DONT_INCLUDE_CONST_FILES\n")
170                 file(APPEND ${_file_touched} "#include \"${_file_const}\"\n\n\n")
171         endif()
172
173         #add merged files also to the project so they become editable
174                 if(${GROUP_CODE} MATCHES "flat")
175                 lyx_add_info_files_no_group(${${_list}})
176         else()
177                 lyx_add_info_files(MergedFiles ${${_list}})
178         endif()
179
180         set(${_file_list} ${_file_const} ${_file_touched} ${lyx_${groupname}_info_files})
181
182         foreach (_current_FILE ${${_list}})
183                 get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
184                 # don't include any generated files in the final-file
185                 # because then cmake will not know the dependencies
186                 get_source_file_property(_isGenerated ${_abs_FILE} GENERATED)
187                 if (_isGenerated)
188                         list(APPEND ${_file_list} ${_abs_FILE})
189                 else()
190                   GET_FILENAME_COMPONENT(_file_name ${_abs_FILE} NAME_WE)
191                   STRING(REGEX REPLACE "-" "_" _file_name "${_file_name}")
192                   set(__macro_name ${_file_name}___ASSUME_CONST)
193
194                   if (_rebuild_file_const)
195                           file(APPEND ${_file_const}  "#define ${__macro_name}\n")
196                           file(APPEND ${_file_const}  "#if defined(${__macro_name}) && !defined(DONT_INCLUDE_CONST_FILES)\n")
197                           file(APPEND ${_file_const}  "#include \"${_abs_FILE}\"\n")
198                           file(APPEND ${_file_const}  "#endif\n\n")
199                   endif()
200
201                   if (_rebuild_file_touched)
202                           file(APPEND ${_file_touched}  "#ifndef ${__macro_name}\n")
203                           file(APPEND ${_file_touched}  "#include \"${_abs_FILE}\"\n")
204                           file(APPEND ${_file_touched}  "#endif\n\n")
205                   endif()
206                 endif()
207         endforeach (_current_FILE)
208 endmacro(lyx_const_touched_files)
209
210 macro(LYX_OPTION_INIT)
211         set(LYX_OPTIONS)
212         set(LYX_OPTION_STRINGS)
213 endmacro()
214
215
216 macro(LYX_OPTION _name _description _default _sys)
217         set(_msg OFF)
218         if(${_sys} MATCHES "GCC")
219                 set(_system CMAKE_COMPILER_IS_GNUCXX)
220         elseif(${_sys} MATCHES "MAC")
221                 set(_system APPLE)
222         else()
223                 set(_system ${_sys})
224         endif()
225         if(${_system} MATCHES "ALL")
226                 option(LYX_${_name} ${_description} ${_default})
227                 set(_msg ON)
228         else()
229                 if(${${_system}})
230                         option(LYX_${_name} ${_description} ${_default})
231                         set(_msg ON)
232                 endif()
233         endif()
234         list(APPEND LYX_OPTIONS LYX_${_name})
235         set(LYX_${_name}_description ${_description})
236         set(LYX_${_name}_show_message ${_msg})
237 endmacro()
238
239 macro(LYX_COMBO _name _description _default)
240   set(_lyx_name "LYX_${_name}")
241   set(${_lyx_name} ${_default} CACHE STRING "${_description}")
242   set(_combo_list ${_default} ${ARGN})
243   set_property(CACHE ${_lyx_name} PROPERTY STRINGS ${_combo_list})
244   list(APPEND LYX_OPTIONS ${_lyx_name})
245   set(${_lyx_name}_show_message ON)
246   string(REGEX REPLACE ";" " " _use_list "${_combo_list}")
247   set(${_lyx_name}_description "${_description} (${_use_list})")
248   list(APPEND LYX_OPTION_STRINGS ${_lyx_name})
249   # Now check the value
250   list(FIND _combo_list ${${_lyx_name}} _idx)
251   if (_idx LESS 0)
252     message(FATAL_ERROR "${_lyx_name} set to \"${${_lyx_name}}\", but has to be only one of (${_use_list})")
253   endif()
254 endmacro()
255
256 macro(LYX_STRING _name _description _default)
257   set(_lyx_name "LYX_${_name}")
258   list(APPEND LYX_OPTIONS ${_lyx_name})
259   set(${_lyx_name}_show_message ON)
260   set(${_lyx_name}_description "${_description}")
261   list(APPEND LYX_OPTION_STRINGS ${_lyx_name})
262   # Now check the value
263   # Should not contain ' '
264   set(tmp_lyx_name ${${_lyx_name}})
265   if (NOT "${${_lyx_name}}" STREQUAL "")
266     if (NOT "${tmp_lyx_name}" MATCHES "^\\..*$")
267       set(tmp_lyx_name ".${tmp_lyx_name}")
268     endif()
269     if (NOT "${tmp_lyx_name}" MATCHES "^\\.[a-zA-Z_0-9\\.]+$")
270       message(FATAL_ERROR "Invalid string for lyx suffix (${tmp_lyx_name})")
271     endif()
272   endif()
273   set(${_lyx_name} "${tmp_lyx_name}" CACHE STRING "${_description}" FORCE)
274 endmacro()
275
276 macro(LYX_OPTION_LIST_ALL)
277         if(UNIX)
278                 set(run_cmake ${CMAKE_BINARY_DIR}/run_cmake.sh)
279                 file(WRITE ${run_cmake} "#!/bin/bash \n")
280                 execute_process(COMMAND chmod 755 ${run_cmake})
281                 set(cont "\\\n")
282         elseif(WIN32)
283                 set(run_cmake ${CMAKE_BINARY_DIR}/run_cmake.bat)
284                 file(WRITE ${run_cmake} "")
285                 set(cont "<nul ^\n")
286         endif()
287         file(APPEND ${run_cmake} "cmake ${CMAKE_SOURCE_DIR}  ${cont}")
288         file(APPEND ${run_cmake} " -G\"${CMAKE_GENERATOR}\"  ${cont}")
289         foreach(_option ${LYX_OPTIONS})
290                 if(${_option}_show_message OR ${ARGV0} STREQUAL "help")
291                         get_property(_prop CACHE ${_option} PROPERTY STRINGS)
292                         list(FIND LYX_OPTION_STRINGS ${_option} _index)
293                         set(_type "BOOL")
294                         if (${_index} GREATER -1)
295                           #message(STATUS "${_option} is of type string")
296                           set(_isset ${${_option}})
297                           set(_type "STRING")
298                         elseif(${_option})
299                                 set(_isset ON)
300                         else()
301                                 set(_isset OFF)
302                         endif()
303                         string(SUBSTRING "${_option}:${_type}                            " 0 35 _var)
304                         string(SUBSTRING "${_isset}           " 0 7 _val)
305                         message(STATUS "${_var}= ${_val}: ${${_option}_description}")
306                         file(APPEND ${run_cmake} " -D${_option}:${_type}=${${_option}}  ${cont}")
307                 endif()
308         endforeach()
309         file(APPEND ${run_cmake} "\n")
310         message(STATUS)
311         message(STATUS "CMake command with options is available in shell script")
312         message(STATUS "    '${run_cmake}'")
313 endmacro()
314
315 macro(lyx_add_info_files group)
316         foreach(_it ${ARGN})
317                 if(NOT IS_DIRECTORY ${_it})
318                         get_filename_component(name ${_it} NAME)
319                         if(NOT ${_it} MATCHES "^/\\\\..*$;~$")
320                                 set_source_files_properties(${_it} PROPERTIES HEADER_FILE_ONLY TRUE)
321                                 set(lyx_${group}_info_files ${lyx_${group}_info_files} ${_it})
322                         endif()
323                 endif()
324         endforeach()
325         set(check_group ${group}) #cmake bug?
326         if(check_group)
327                 source_group(${group} FILES ${lyx_${group}_info_files})
328         endif()
329         set(lyx_info_files ${lyx_info_files} ${lyx_${group}_info_files})
330 endmacro()
331
332 macro(lyx_add_info_files_no_group)
333         lyx_add_info_files( "" ${ARGN})
334 endmacro()
335
336 macro(lyx_find_info_files group files)
337         file(GLOB _filelist ${files})
338         lyx_add_info_files(${group} ${_filelist})
339 endmacro()
340
341 macro(settestlabel testname)
342   get_property(_lab_list TEST ${testname} PROPERTY LABELS)
343   if(_lab_list)
344     list(APPEND _lab_list "${ARGN}")
345   else()
346     set(_lab_list "${ARGN}")
347   endif()
348   list(REMOVE_DUPLICATES _lab_list)
349   set_tests_properties(${testname} PROPERTIES LABELS "${_lab_list}")
350 endmacro()
351
352 macro(sortlabellist listout)
353   set(tmplist "")
354   foreach(_lab ${ARGN})
355     list(APPEND tmplist "${depth_${_lab}}${_lab}")
356   endforeach()
357   list(SORT tmplist)
358   string(REGEX REPLACE ";[-0-9]+" ";" ${listout} ";${tmplist}")
359 endmacro()
360
361 macro(createlabel reslabel first)
362   set(${reslabel} ${first})
363   foreach(_lab ${ARGN})
364     set(${reslabel} "${${reslabel}}:${_lab}")
365   endforeach()
366 endmacro()
367
368 macro(setmarkedtestlabel testname)
369   sortlabellist(mynewlablelist ${ARGN})
370   createlabel(mynewlabel ${mynewlablelist})
371   settestlabel(${testname} ${mynewlabel})
372 endmacro()
373
374 macro(lyx_target_link_libraries _target)
375   foreach(_lib ${ARGN})
376     string(TOUPPER ${_lib} _ulib)
377     if(${_ulib}_FOUND)
378       #message(STATUS "target_link_libraries(${_target} ${${_lib}_LIBRARY})")
379       target_link_libraries(${_target} ${${_lib}_LIBRARY})
380     endif()
381   endforeach()
382 endmacro()
383
384 # Check if python module exists
385 # Idea stolen from http://public.kitware.com/pipermail/cmake/2011-January/041666.html
386 function(find_python_module module)
387   string(TOUPPER ${module} module_upper)
388   if(NOT LYX_PY_${module_upper})
389     if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
390       set(LYX_PY_${module}_FIND_REQUIRED TRUE)
391     endif()
392     # A module's location is usually a directory, but for binary modules
393     # it's a .so file.
394     execute_process(COMMAND "${LYX_PYTHON_EXECUTABLE}" "-c"
395       "import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
396       RESULT_VARIABLE _${module}_status
397       OUTPUT_VARIABLE _${module}_location
398       ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
399     if(NOT _${module}_status)
400       set(LYX_PY_${module_upper} ${_${module}_location} CACHE STRING
401         "Location of Python module ${module}")
402     endif()
403   endif()
404   find_package_handle_standard_args(LYX_PY_${module} DEFAULT_MSG LYX_PY_${module_upper})
405 endfunction(find_python_module)
406
407 macro(setstripped _varname)
408         if(${ARGC} GREATER 1)
409                 string(STRIP "${ARGV1}" _v)
410                 if (_v MATCHES "^\\[\(.+\)\\]$")
411                   set(_v ${CMAKE_MATCH_1})
412                 endif()
413                 if(USE_POSIX_PACKAGING)
414                         string(TOLOWER ${_v} ${_varname})
415                 else()
416                         set(${_varname} ${_v})
417                 endif()
418         else()
419                 set(${_varname})
420         endif()
421 endmacro(setstripped)
422
423 # Determine the version and build-type
424 function(determineversionandbuildtype configfile package version dirs date buildtype)
425   file(STRINGS "${configfile}" _config_lines)
426   foreach(_c_l ${_config_lines} )
427     if(_c_l MATCHES "^AC_INIT\\(\([^,]+\),\([^,]+\), *\\[\([^,]+\)\\] *,\(.*\)")
428       # Not using CMAKE_MATCH_ directly is needed, because
429       # its value is now changed inside macro setstripped
430       set(_PB ${CMAKE_MATCH_1})
431       set(_PV ${CMAKE_MATCH_2})
432       set(_PBU ${CMAKE_MATCH_3})
433       setstripped(PACKAGE_BASE ${_PB})
434       setstripped(PACKAGE_VERSION ${_PV})
435       setstripped(PACKAGE_BUGREPORT ${_PBU})
436       set(${package} ${PACKAGE_BASE} ${PACKAGE_VERSION} ${PACKAGE_BUGREPORT} PARENT_SCOPE)
437       if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\(\\.\([0-9]+\)\)?\)?\([a-z]*\).*$")
438         set(LYX_MAJOR_VERSION ${CMAKE_MATCH_1})
439         set(LYX_MINOR_VERSION ${CMAKE_MATCH_2})
440         set(LYX_RELEASE_LEVEL ${CMAKE_MATCH_4})
441         set(LYX_RELEASE_PATCH ${CMAKE_MATCH_6})
442         set(LYX_BUILD_TYPE ${CMAKE_MATCH_7})
443         set(LYX_DIR_VER "LYX_DIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
444         set(LYX_USERDIR_VER "LYX_USERDIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
445         if (NOT LYX_RELEASE_LEVEL)
446           set(LYX_RELEASE_LEVEL 0)
447         endif()
448         if (NOT LYX_RELEASE_PATCH)
449           set(LYX_RELEASE_PATCH 0)
450         endif()
451         set(LYX_VERSION "${LYX_MAJOR_VERSION}.${LYX_MINOR_VERSION}")
452       endif()
453     endif()
454     if(_c_l MATCHES "^AC_SUBST\\( *LYX_DATE *, *\\[\\\"(.*)\\\"\\].*")
455       set(LYX_DATE "${CMAKE_MATCH_1}")
456     endif()
457   endforeach(_c_l)
458   set(${version} ${LYX_VERSION} ${LYX_MAJOR_VERSION} ${LYX_MINOR_VERSION} ${LYX_RELEASE_LEVEL} ${LYX_RELEASE_PATCH} PARENT_SCOPE)
459   set(${dirs} ${LYX_DIR_VER} ${LYX_USERDIR_VER} PARENT_SCOPE)
460   set(${date} ${LYX_DATE} PARENT_SCOPE)
461   if(LYX_BUILD_TYPE MATCHES "^\(dev\)$")
462     set(${buildtype} "development" PARENT_SCOPE)
463   elseif(LYX_BUILD_TYPE MATCHES "^\(alpha|beta|rc|pre\)$")
464     set(${buildtype} "prerelease" PARENT_SCOPE)
465   elseif(LYX_BUILD_TYPE MATCHES "^$")
466     set(${buildtype} "release" PARENT_SCOPE)
467   else()
468     set(${buildtype} "unknown" PARENT_SCOPE)
469     message(FATAL_ERROR "\"${configfile}\": Unable to determine build-type from suffix \"${LYX_BUILD_TYPE}\" in AC_INIT macro")
470   endif()
471 endfunction(determineversionandbuildtype)
472
473 # determine known cmake cxx_std features but only if not greater than ${max_desired}
474 function(lyxgetknowncmakestd max_desired result)
475   set(tmp_list)
476   set(CXX_STD_LIST)
477   math(EXPR max_desired "${max_desired}+1")
478   if (CMAKE_VERSION VERSION_LESS "3.9")
479     list(APPEND tmp_list 98 11 14)
480   else()
481     foreach(_e ${CMAKE_CXX_COMPILE_FEATURES})
482       if (_e MATCHES "^cxx_std_\(.*)")
483         list(APPEND tmp_list ${CMAKE_MATCH_1})
484       endif()
485     endforeach()
486   endif()
487   list(REVERSE tmp_list)
488   # Filter undesired from list
489   foreach(i ${tmp_list})
490     if (i LESS ${max_desired} OR i GREATER 89)
491       list(APPEND CXX_STD_LIST ${i})
492     endif()
493   endforeach()
494   set(${result} ${CXX_STD_LIST} PARENT_SCOPE)
495 endfunction()
496