]> git.lyx.org Git - features.git/blobdiff - development/cmake/modules/LyXMacros.cmake
Cmake build: Allow user defined suffix for program files
[features.git] / development / cmake / modules / LyXMacros.cmake
index 999fb95a2fe5905db9d225e721e1dbd62b252f49..be7470c93f4e8f6037141e92bc330ebdedab1c91 100644 (file)
@@ -40,7 +40,7 @@ endmacro(lyx_add_path _out _prefix)
 
 #create the implementation files from the ui files and add them
 #to the list of sources
-#usage: LYX_ADD_QT4_UI_FILES(foo_SRCS ${ui_files})
+#usage: LYX_ADD_UI_FILES(foo_SRCS ${ui_files})
 macro(LYX_ADD_UI_FILES _sources _ui_files)
        set(uifiles})
        foreach (_current_FILE ${ARGN})
@@ -104,7 +104,9 @@ macro(LYX_AUTOMOC)
 
                                        set(_moc  ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
                                        if (WIN32)
-                                                         set(_def -D_WIN32)
+                                               set(_def -D_WIN32)
+                                       else()
+                                               set(_def)
                                        endif()
                                        #set(_moc ${_abs_PATH}/${_current_MOC})
                                        add_custom_command(OUTPUT ${_moc}
@@ -207,6 +209,7 @@ endmacro(lyx_const_touched_files)
 
 macro(LYX_OPTION_INIT)
        set(LYX_OPTIONS)
+       set(LYX_OPTION_STRINGS)
 endmacro()
 
 
@@ -242,6 +245,7 @@ macro(LYX_COMBO _name _description _default)
   set(${_lyx_name}_show_message ON)
   string(REGEX REPLACE ";" " " _use_list "${_combo_list}")
   set(${_lyx_name}_description "${_description} (${_use_list})")
+  list(APPEND LYX_OPTION_STRINGS ${_lyx_name})
   # Now check the value
   list(FIND _combo_list ${${_lyx_name}} _idx)
   if (_idx LESS 0)
@@ -249,6 +253,26 @@ macro(LYX_COMBO _name _description _default)
   endif()
 endmacro()
 
+macro(LYX_STRING _name _description _default)
+  set(_lyx_name "LYX_${_name}")
+  list(APPEND LYX_OPTIONS ${_lyx_name})
+  set(${_lyx_name}_show_message ON)
+  set(${_lyx_name}_description "${_description}")
+  list(APPEND LYX_OPTION_STRINGS ${_lyx_name})
+  # Now check the value
+  # Should not contain ' '
+  set(tmp_lyx_name ${${_lyx_name}})
+  if (NOT "${${_lyx_name}}" STREQUAL "")
+    if (NOT "${tmp_lyx_name}" MATCHES "^\\..*$")
+      set(tmp_lyx_name ".${tmp_lyx_name}")
+    endif()
+    if (NOT "${tmp_lyx_name}" MATCHES "^\\.[a-zA-Z_\\.]+$")
+      message(FATAL_ERROR "Invalid string for lyx suffix (${tmp_lyx_name})")
+    endif()
+  endif()
+  set(${_lyx_name} "${tmp_lyx_name}" CACHE STRING "${_description}" FORCE)
+endmacro()
+
 macro(LYX_OPTION_LIST_ALL)
        if(UNIX)
                set(run_cmake ${CMAKE_BINARY_DIR}/run_cmake.sh)
@@ -266,7 +290,9 @@ macro(LYX_OPTION_LIST_ALL)
                if(${_option}_show_message OR ${ARGV0} STREQUAL "help")
                        string(SUBSTRING "${_option}                            " 0 25 _var)
                         get_property(_prop CACHE ${_option} PROPERTY STRINGS)
-                        if(_prop)
+                       list(FIND LYX_OPTION_STRINGS ${_option} _index)
+                       if (${_index} GREATER -1)
+                         #message(STATUS "${_option} is of type string")
                           set(_isset ${${_option}})
                        elseif(${_option})
                                set(_isset ON)
@@ -321,14 +347,27 @@ macro(settestlabel testname)
   set_tests_properties(${testname} PROPERTIES LABELS "${_lab_list}")
 endmacro()
 
-macro(setmarkedtestlabel testname reverted)
-  if(reverted)
-    settestlabel(${testname} "reverted" ${ARGN})
-  else()
-    settestlabel(${testname} ${ARGN})
-  endif()
+macro(sortlabellist listout)
+  set(tmplist "")
+  foreach(_lab ${ARGN})
+    list(APPEND tmplist "${depth_${_lab}}${_lab}")
+  endforeach()
+  list(SORT tmplist)
+  string(REGEX REPLACE ";[-0-9]+" ";" ${listout} ";${tmplist}")
 endmacro()
 
+macro(createlabel reslabel first)
+  set(${reslabel} ${first})
+  foreach(_lab ${ARGN})
+    set(${reslabel} "${${reslabel}}:${_lab}")
+  endforeach()
+endmacro()
+
+macro(setmarkedtestlabel testname)
+  sortlabellist(mynewlablelist ${ARGN})
+  createlabel(mynewlabel ${mynewlablelist})
+  settestlabel(${testname} ${mynewlabel})
+endmacro()
 
 macro(lyx_target_link_libraries _target)
   foreach(_lib ${ARGN})