cmake: -Dhelp=1 lists all options

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38696 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2011-05-10 20:25:31 +00:00
parent 5c1666c0e1
commit 842f0d3d44
3 changed files with 22 additions and 8 deletions

View File

@ -7,7 +7,6 @@
cmake_minimum_required(VERSION 2.6.4)
set(LYX_PROJECT lyx)
project(${LYX_PROJECT})
set(LYX_CMAKE_DIR "development/cmake")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/${LYX_CMAKE_DIR}/modules")
@ -17,13 +16,13 @@ get_filename_component(TOP_SRC_DIR ${lyx_dir_readme} PATH)
set(CMAKE_PROJECT_NAME ${LYX_PROJECT})
message(STATUS)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Building in-source")
set(TOP_BINARY_DIR "${CMAKE_BINARY_DIR}/build")
else()
message(STATUS "Building out-of-source")
set(TOP_BINARY_DIR "${CMAKE_BINARY_DIR}")
#cmake_policy(SET CMP0013 OLD)
endif()
@ -82,7 +81,21 @@ LYX_OPTION(WALL "Enable all warnings" OFF MSVC)
LYX_OPTION(CONFIGURE_CHECKS "Also run configure checks for MSVC" OFF MSVC)
LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
if(help OR HELP)
message(STATUS)
message(STATUS "Available options: (dis/enable with -D=0/1)")
message(STATUS)
LYX_OPTION_LIST_ALL(help)
message(STATUS)
else()
# 'project' triggers the searching for a compiler
project(${LYX_PROJECT})
# Check option dependencies
if(LYX_CPACK)
set(LYX_INSTALL ON)
endif()
@ -151,7 +164,7 @@ set(VERSION_INFO "CMake Build")
# Try to get some informations from configure.ac
include(LyXPaths) #called here to define the needed TOP_SRC_DIR-variable
include(LyXPaths)
file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines)
if(WIN32)
@ -518,7 +531,7 @@ endif()
message(STATUS)
message(STATUS "Build options, switch LYX_* variables by -DLYX_*=1 or 0:")
message(STATUS)
LYX_OPTION_LIST_ALL()
LYX_OPTION_LIST_ALL(used)
set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
@ -604,4 +617,5 @@ endif()
#
message(STATUS)
endif() #help

View File

@ -132,17 +132,17 @@ Build options
Options could be passed by the -D prefix when running cmake.
Available options will be listed on each cmake run.
Here the options with their default value:
-Dhelp=1 lists all available options:
# Available on all systems/compilers
-- LYX_CPACK = OFF : Use the CPack management (Implies LYX_INSTALL option)
-- LYX_INSTALL = OFF : Build install projects/rules (implies a bunch of other options)
-- LYX_NLS = OFF : Use nls
-- LYX_NLS = ON : Use nls
-- LYX_ASPELL = OFF : Require aspell
-- LYX_ENCHANT = OFF : Require Enchant
-- LYX_HUNSPELL = OFF : Require Hunspell
-- LYX_DEVEL_VERSION = OFF : Build developer version
-- LYX_RELEASE = ON : Build release version, build debug when disabled
-- LYX_RELEASE = OFF : Build release version, build debug when disabled
-- LYX_PACKAGE_SUFFIX = ON : Use version suffix for packaging
-- LYX_PCH = OFF : Use precompiled headers
-- LYX_MERGE_FILES = OFF : Merge source files into one compilation unit

View File

@ -261,7 +261,7 @@ endmacro()
macro(LYX_OPTION_LIST_ALL)
foreach(_option ${LYX_OPTIONS})
if(${_option}_show_message)
if(${_option}_show_message OR ${ARGV0} STREQUAL "help")
string(SUBSTRING "${_option} " 0 25 _var)
if(${_option})
set(_isset ON)