#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})
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}
macro(LYX_OPTION_INIT)
set(LYX_OPTIONS)
+ set(LYX_OPTION_STRINGS)
endmacro()
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})
- set(LYX_${_name}_show_message ON)
- set(LYX_${_name}_description ${_description})
+ set(_lyx_name "LYX_${_name}")
+ set(${_lyx_name} ${_default} CACHE STRING "${_description}")
+ set(_combo_list ${_default} ${ARGN})
+ set_property(CACHE ${_lyx_name} PROPERTY STRINGS ${_combo_list})
+ list(APPEND LYX_OPTIONS ${_lyx_name})
+ 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)
+ message(FATAL_ERROR "${_lyx_name} set to \"${${_lyx_name}}\", but has to be only one of (${_use_list})")
+ 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(${_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)
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})
+ string(TOUPPER ${_lib} _ulib)
+ if(${_ulib}_FOUND)
+ #message(STATUS "target_link_libraries(${_target} ${${_lib}_LIBRARY})")
+ target_link_libraries(${_target} ${${_lib}_LIBRARY})
+ endif()
+ endforeach()
endmacro()