From 07eef68a90c3f54b41245708da45f46bb3ce5559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Wed, 7 Jul 2010 22:26:36 +0000 Subject: [PATCH] cmake: only set and show compiler relevant options git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34803 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/cmake/CMakeLists.txt | 45 +++++++++++++---------- development/cmake/modules/LyXMacros.cmake | 19 ++++++++-- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 7f5bdf58da..d9426b63b1 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -24,25 +24,32 @@ include(LyXMacros) message(STATUS) message(STATUS "Switch LYX_* variables by -DLYX_*=1 or 0:") -LYX_OPTION(NLS "Use nls" OFF) -LYX_OPTION(ASPELL "Require aspell" OFF) -LYX_OPTION(DEBUG "Build debug version" OFF) -LYX_OPTION(RELEASE "Build release version" ON) -LYX_OPTION(PROFILE "Build profile version" OFF) -LYX_OPTION(USE_EXTERNAL_BOOST "Use external boost" OFF) -LYX_OPTION(USE_EXTERNAL_LIBINTL "Use external libintl" ON) -LYX_OPTION(INSTALL "Build install projects/rules" ON) -LYX_OPTION(USE_VERSION_SUFFIX "Use version suffix for packaging" OFF) -LYX_OPTION(NO_CONSOLE "Suppress console on Windows" OFF) -LYX_OPTION(VLD "Use VLD on with MSVC" OFF) -LYX_OPTION(DISABLE_PCH "Disable precompiled headers" ON) -LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF) -LYX_OPTION(DEBUG_GLIBC "Enable libstdc++ debug mode" OFF) -LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++pedantic debug mode" OFF) -LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" OFF) -LYX_OPTION(CONCEPT_CHECKS "Enable concept-checks" OFF) -LYX_OPTION(QUIET "Don't generate verbose makefiles" OFF) -LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF) + +# Usage LYX_OPTION +# 1. parameter: option name without prefix 'LYX_' +# 2. parameter: description +# 3. parameter: default value, ON or OFF +# 4. parameter: system on which option is used: ALL, GCC, MSVC, ... +LYX_OPTION(NLS "Use nls" OFF ALL) +LYX_OPTION(ASPELL "Require aspell" OFF ALL) +LYX_OPTION(DEBUG "Build debug version" OFF ALL) +LYX_OPTION(RELEASE "Build release version" ON ALL) +LYX_OPTION(PROFILE "Build profile version" OFF GCC) +LYX_OPTION(USE_EXTERNAL_BOOST "Use external boost" OFF GCC) +LYX_OPTION(USE_EXTERNAL_LIBINTL "Use external libintl" ON GCC) +LYX_OPTION(INSTALL "Build install projects/rules" ON ALL) +LYX_OPTION(USE_VERSION_SUFFIX "Use version suffix for packaging" OFF ALL) +LYX_OPTION(NO_CONSOLE "Suppress console on Windows" OFF MSVC) +LYX_OPTION(VLD "Use VLD on with MSVC" OFF MSVC) +LYX_OPTION(DISABLE_PCH "Disable precompiled headers" ON ALL) +LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF ALL) +LYX_OPTION(DEBUG_GLIBC "Enable libstdc++ debug mode" OFF GCC) +LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++pedantic debug mode" OFF GCC) +LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" OFF GCC) +LYX_OPTION(CONCEPT_CHECKS "Enable concept-checks" OFF GCC) +LYX_OPTION(QUIET "Don't generate verbose makefiles" OFF ALL) +LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF ALL) + message(STATUS) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake index d85b6aa9f4..1643e880bc 100644 --- a/development/cmake/modules/LyXMacros.cmake +++ b/development/cmake/modules/LyXMacros.cmake @@ -227,9 +227,22 @@ macro(lyx_qt_resources_file _qrc_name _to_dir _list) endmacro(lyx_qt_resources_file) -macro(LYX_OPTION _name _description _default) - option(LYX_${_name} ${_description} ${_default}) - set(_msg ON) +macro(LYX_OPTION _name _description _default _sys) + set(_msg OFF) + if(${_sys} MATCHES "GCC") + set(_system CMAKE_COMPILER_IS_GNUCXX) + else() + set(_system ${_sys}) + endif() + if(${_system} MATCHES "ALL") + option(LYX_${_name} ${_description} ${_default}) + set(_msg ON) + else() + if(${${_system}}) + option(LYX_${_name} ${_description} ${_default}) + set(_msg ON) + endif() + endif() if(_msg) string(SUBSTRING "LYX_${_name} " 0 25 _var) string(SUBSTRING "${LYX_${_name}} " 0 4 _val)