]> git.lyx.org Git - features.git/commitdiff
Cmake build: Allow user defined suffix for program files
authorKornel Benko <kornel@lyx.org>
Sun, 5 Jun 2016 14:26:59 +0000 (16:26 +0200)
committerKornel Benko <kornel@lyx.org>
Sun, 5 Jun 2016 14:26:59 +0000 (16:26 +0200)
CMakeLists.txt
development/cmake/modules/LyXMacros.cmake

index 68753c197ac6629a83de0a1c2a5a55f80814e295..72bbf353255685ade15c592dc20251ae3caba176 100644 (file)
@@ -129,6 +129,7 @@ LYX_OPTION(RELEASE          "Build release version, build debug when disabled" O
 LYX_OPTION(DEBUG            "Enforce debug build"  OFF ALL)
 LYX_OPTION(NO_OPTIMIZE      "Don't use any optimization/debug flags"  OFF ALL)
 LYX_OPTION(PACKAGE_SUFFIX   "Use version suffix for packaging" ON ALL)
+LYX_STRING(SUFFIX_VALUE     "Use this string as suffix" "")
 LYX_OPTION(PCH              "Use precompiled headers" OFF ALL)
 LYX_OPTION(MERGE_FILES      "Merge source files into one compilation unit" OFF ALL)
 LYX_OPTION(MERGE_REBUILD    "Rebuild generated files from merged files build" OFF ALL)
@@ -345,7 +346,11 @@ foreach(_c_l ${_config_lines} )
                        set(LYX_PATCH_VERSION ${CMAKE_MATCH_4})
                        set(LYX_DIR_VER "LYX_DIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
                        set(LYX_USERDIR_VER "LYX_USERDIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
-                       set(LYX_INSTALL_SUFFIX "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
+                       if ("${LYX_SUFFIX_VALUE}" MATCHES "")
+                         set(LYX_INSTALL_SUFFIX "${LYX_MAJOR_VERSION}.${LYX_MINOR_VERSION}")
+                       else()
+                         set(LYX_INSTALL_SUFFIX "${LYX_SUFFIX_VALUE}")
+                       endif()
                endif()
        endif()
        if(_c_l MATCHES "^AC_SUBST\\( *LYX_DATE *, *\\[\\\"(.*)\\\"\\].*")
index 2e2f7d89306a9e986de1d6deeaf71c21baf26764..be7470c93f4e8f6037141e92bc330ebdedab1c91 100644 (file)
@@ -209,6 +209,7 @@ endmacro(lyx_const_touched_files)
 
 macro(LYX_OPTION_INIT)
        set(LYX_OPTIONS)
+       set(LYX_OPTION_STRINGS)
 endmacro()
 
 
@@ -244,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)
@@ -251,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)
@@ -268,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)