]> git.lyx.org Git - features.git/blobdiff - development/cmake/modules/LyXMacros.cmake
Cmake build: Added convenience macro LYX_COMBO
[features.git] / development / cmake / modules / LyXMacros.cmake
index b41de4d8a0a3b44e20e661d28edd48c9ac0487ba..2bddaaf079645d37fe499bf24b2af57d8bc9e8cf 100644 (file)
@@ -25,6 +25,8 @@
 #  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
+include (MacroAddFileDependencies)
+
 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
 
 macro(lyx_add_path _list _prefix)
@@ -39,9 +41,9 @@ 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})
-macro(LYX_ADD_UI_FILES _sources _ui)
+macro(LYX_ADD_UI_FILES _sources _ui_files)
+       set(uifiles})
        foreach (_current_FILE ${ARGN})
-
                get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
                get_filename_component(_basename ${_tmp_FILE} NAME_WE)
                set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h)
@@ -51,11 +53,10 @@ macro(LYX_ADD_UI_FILES _sources _ui)
                # ######
                # Latest test showed on linux and windows show no bad consequeces,
                # so we removed the call to LyXuic.cmake
-               add_custom_command(OUTPUT ${_header}
-        COMMAND ${QT_UIC_EXECUTABLE} -tr lyx::qt_ ${_tmp_FILE} -o ${_header}
-                       MAIN_DEPENDENCY ${_tmp_FILE})
-               set(${_ui} ${${_ui}} ${_header})
-       endforeach (_current_FILE)
+               qt_wrap_uifiles(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_)
+               list(APPEND uifiles ${_header})
+       endforeach()
+       set(${_ui_files} ${uifiles})
 endmacro(LYX_ADD_UI_FILES)
 
 
@@ -173,7 +174,7 @@ macro(lyx_const_touched_files _allinone_name _list)
        else()
                lyx_add_info_files(MergedFiles ${${_list}})
        endif()
-       
+
        set(${_file_list} ${_file_const} ${_file_touched} ${lyx_${groupname}_info_files})
 
        foreach (_current_FILE ${${_list}})
@@ -204,39 +205,6 @@ macro(lyx_const_touched_files _allinone_name _list)
        endforeach (_current_FILE)
 endmacro(lyx_const_touched_files)
 
-
-macro(lyx_qt_resources_file _qrc_name _to_dir _list)
-       if (NOT EXISTS ${_qrc_name})
-               set(_rebuild_file 1)
-       else()
-               FILE(READ ${_qrc_name} _file_content)
-               if (NOT _file_content)
-                       set(_rebuild_file 1)
-               endif()
-       endif()
-
-       if (_rebuild_file)
-               message(STATUS "Generating ${_qrc_name}")
-               file(WRITE  ${_qrc_name} "<!DOCTYPE RCC><RCC version=\"1.0\">\n")
-               file(APPEND  ${_qrc_name} "<qresource>\n")
-
-               foreach (_current_FILE ${${_list}})
-                       get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
-                       string(REGEX REPLACE "${_to_dir}" "" _file_name ${_abs_FILE})
-                       file(APPEND  ${_qrc_name} "      <file alias=\"${_file_name}\">${_abs_FILE}</file>\n")
-               endforeach (_current_FILE)
-
-               file(APPEND  ${_qrc_name} "</qresource>\n")
-               file(APPEND  ${_qrc_name} "</RCC>\n")
-       endif()
-       add_custom_command(
-         OUTPUT ${_qrc_name}
-         COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}" --target rebuild_cache
-         )
-
-endmacro(lyx_qt_resources_file)
-
-
 macro(LYX_OPTION_INIT)
        set(LYX_OPTIONS)
 endmacro()
@@ -265,6 +233,11 @@ macro(LYX_OPTION _name _description _default _sys)
        set(LYX_${_name}_show_message ${_msg})
 endmacro()
 
+macro(LYX_COMBO _name _description _default)
+  set(LYX_${_name} ${_default} CACHE STRING "${_description}")
+  set_property(CACHE LYX_${_name} PROPERTY STRINGS ${_default} ${ARGN})
+  list(APPEND LYX_OPTIONS LYX_${_name})
+endmacro()
 
 macro(LYX_OPTION_LIST_ALL)
        if(UNIX)
@@ -323,3 +296,23 @@ macro(lyx_find_info_files group files)
        file(GLOB _filelist ${files})
        lyx_add_info_files(${group} ${_filelist})
 endmacro()
+
+macro(settestlabel testname)
+  get_property(_lab_list TEST ${testname} PROPERTY LABELS)
+  if(_lab_list)
+    list(APPEND _lab_list "${ARGN}")
+  else()
+    set(_lab_list "${ARGN}")
+  endif()
+  list(REMOVE_DUPLICATES _lab_list)
+  set_tests_properties(${testname} PROPERTIES LABELS "${_lab_list}")
+endmacro()
+
+macro(setmarkedtestlabel testname reverted)
+  if(reverted)
+    settestlabel(${testname} "reverted" ${ARGN})
+  else()
+    settestlabel(${testname} ${ARGN})
+  endif()
+endmacro()
+