diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 0cd329321e..767c9ba3da 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -24,14 +24,14 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") include(LyXMacros) -message(STATUS) -message(STATUS "Switch LYX_* variables by -DLYX_*=1 or 0:") - -# Usage LYX_OPTION +# Usage of 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, ... +message(STATUS) +message(STATUS "Switch LYX_* variables by -DLYX_*=1 or 0:") +message(STATUS) LYX_OPTION(NLS "Use nls" OFF ALL) LYX_OPTION(ASPELL "Require aspell" OFF ALL) LYX_OPTION(DEBUG "Build debug version" OFF ALL) @@ -44,6 +44,7 @@ LYX_OPTION(PACKAGE_SUFFIX "Use version suffix for packaging" OFF ALL) LYX_OPTION(PROGRAM_SUFFIX "Append version suffix to binaries" ON GCC) LYX_OPTION(NO_CONSOLE "Suppress console on Windows" OFF MSVC) LYX_OPTION(VLD "Use VLD with MSVC" OFF MSVC) +LYX_OPTION(WALL "Enable all warnings" 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) @@ -151,14 +152,14 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if (WIN32) - set(DATA_SUBDIR "Resources/" CACHE STRING "Subdirectory for all lyx-system-data" FORCE) + set(LYX_DATA_SUBDIR "Resources/" CACHE STRING "Subdirectory for all lyx-system-data" FORCE) else() - set(DATA_SUBDIR "" CACHE STRING "Subdirectory for all lyx-system-data" FORCE) + set(LYX_DATA_SUBDIR "" CACHE STRING "Subdirectory for all lyx-system-data" FORCE) endif() set(LYX_ABS_INSTALLED_DATADIR "${CMAKE_INSTALL_PREFIX}") set(LYX_LOCALEDIR "locale") -set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${DATA_SUBDIR}${LYX_LOCALEDIR}") +set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_DATA_SUBDIR}${LYX_LOCALEDIR}") set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}") @@ -337,20 +338,16 @@ else() endif() if(MSVC) - if(LYX_VLD) - set(LYX_LEAK_DETECTION 1 CACHE TYPE STRING FORCE) - set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) - set(vld_path ${CMAKE_CURRENT_SOURCE_DIR}/../Win32/vld) - include(${vld_path}/tools/cmake/vld.cmake) - endif() - - # TODO options - if(WALL) - set(WALL 1 CACHE TYPE STRING FORCE) + if(LYX_VLD) + set(LYX_LEAK_DETECTION 1 CACHE TYPE STRING FORCE) + set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) + set(LYX_VLD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../Win32/vld) + include(${LYX_VLD_PATH}/tools/cmake/vld.cmake) + endif() + if(LYX_WALL) # Use the highest warning level set(CMAKE_CXX_WARNING_LEVEL 4 CACHE TYPE STRING FORCE) - set(WARNING_LEVEL_MESSAGE "(switch to warning level 3 with -DWALL=0)") if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -375,13 +372,10 @@ if(MSVC) "${CMAKE_CXX_FLAGS_RELEASE} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Wp64 ${MSVC_W_ERROR} ${MSVC_W_DISABLE}") - + else() - set(WALL 0 CACHE TYPE STRING FORCE) - set(CMAKE_CXX_WARNING_LEVEL 3 CACHE TYPE STRING FORCE) - set(WARNING_LEVEL_MESSAGE "(switch to warning level 4 with -DWALL=1)") - + # add here warnings which should produce an error /weXXXX set(MSVC_W_ERROR "/we4101 /we4189") # add here warnings which should be disabled /wdXXXX @@ -409,9 +403,9 @@ if(MSVC) endif() -FIND_PROGRAM(_PERL_EXECUTABLE perl) -FIND_PROGRAM(_PYTHON_EXECUTABLE python) -if( NOT ${_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND") + +FIND_PROGRAM(LYX_PYTHON_EXECUTABLE python) +if( NOT ${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND") if(LYX_NLS) find_package(LyXGettext REQUIRED) include_directories(${TOP_SRC_DIR}/po) @@ -478,7 +472,8 @@ add_subdirectory(src) if(LYX_INSTALL) add_subdirectory(man) - if(NOT ${_PERL_EXECUTABLE} MATCHES "-NOTFOUND") + FIND_PROGRAM(LYX_PERL_EXECUTABLE perl) + if(NOT ${LYX_PERL_EXECUTABLE} MATCHES "-NOTFOUND") add_subdirectory(doc) endif() endif() diff --git a/development/cmake/Install.cmake b/development/cmake/Install.cmake index c34a2d70e7..fd8f1a55cc 100755 --- a/development/cmake/Install.cmake +++ b/development/cmake/Install.cmake @@ -43,9 +43,9 @@ macro(lyx_install _parent_src_dir _gl_dir _file_type) if(_glob_dir STREQUAL ".") set(_base_dir .) endif() - #message(STATUS "install ${DATA_SUBDIR}${_dir}/${_base_dir}: ${files_list} ") - #message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${DATA_SUBDIR}${_dir}/${_base_dir}") - install(FILES ${files_list} DESTINATION ${DATA_SUBDIR}${_dir}/${_base_dir}) + #message(STATUS "install ${LYX_DATA_SUBDIR}${_dir}/${_base_dir}: ${files_list} ") + #message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${LYX_DATA_SUBDIR}${_dir}/${_base_dir}") + install(FILES ${files_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir}) endif() endforeach(_current_dir) endforeach(_glob_dir) diff --git a/development/cmake/doc/CMakeLists.txt b/development/cmake/doc/CMakeLists.txt index ea30b1f077..1217f83b21 100644 --- a/development/cmake/doc/CMakeLists.txt +++ b/development/cmake/doc/CMakeLists.txt @@ -32,7 +32,7 @@ foreach(_rel_doc ${_rel_lyx_docs}) COMMAND perl "${CMAKE_SOURCE_DIR}/doc/ReplaceValues.pl" "LYX_USERDIR_VER=${LYX_USERDIR_VER}" "LYX_DIR_VER=${LYX_DIR_VER}" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}" DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${DATA_SUBDIR}doc/${_rel_dir_part}") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${LYX_DATA_SUBDIR}doc/${_rel_dir_part}") LIST(APPEND _docs "${_created_doc}") endforeach(_rel_doc) diff --git a/development/cmake/lyx2lyx/CMakeLists.txt b/development/cmake/lyx2lyx/CMakeLists.txt index 61b5706adc..f3517d301e 100644 --- a/development/cmake/lyx2lyx/CMakeLists.txt +++ b/development/cmake/lyx2lyx/CMakeLists.txt @@ -7,11 +7,11 @@ configure_file(${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py.in ${CMAKE_CURRENT_BINARY_DIR}/lyx2lyx_version.py) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx2lyx_version.py DESTINATION ${DATA_SUBDIR}lyx2lyx) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx2lyx_version.py DESTINATION ${LYX_DATA_SUBDIR}lyx2lyx) if (UNIX) set(_project "lyx2lyx") include(../PyCompile) endif() -install(PROGRAMS ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx DESTINATION ${DATA_SUBDIR}lyx2lyx) +install(PROGRAMS ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx DESTINATION ${LYX_DATA_SUBDIR}lyx2lyx) diff --git a/development/cmake/man/CMakeLists.txt b/development/cmake/man/CMakeLists.txt index 1fad6676db..84d4bc32d5 100755 --- a/development/cmake/man/CMakeLists.txt +++ b/development/cmake/man/CMakeLists.txt @@ -26,7 +26,7 @@ endforeach(_mn) ADD_CUSTOM_TARGET(man ALL DEPENDS ${_manuals}) -install(FILES ${_manuals} DESTINATION ${DATA_SUBDIR}man/man1) +install(FILES ${_manuals} DESTINATION ${LYX_DATA_SUBDIR}man/man1) # ADD_MANUALS("lyx") diff --git a/development/cmake/po/CMakeLists.txt b/development/cmake/po/CMakeLists.txt index ed8d73f8ad..d68f73c7a4 100755 --- a/development/cmake/po/CMakeLists.txt +++ b/development/cmake/po/CMakeLists.txt @@ -38,7 +38,7 @@ macro(add_gettext_python _par _dir) ADD_CUSTOM_COMMAND( OUTPUT "${_dst}" PRE_BUILD - COMMAND ${_PYTHON_EXECUTABLE} + COMMAND ${LYX_PYTHON_EXECUTABLE} ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par1} ${_sources} DEPENDS ${_sources} ${_src_files} ) @@ -64,7 +64,7 @@ FIND_PROGRAM(GETTEXT_MSGUNIQ_EXECUTABLE msguniq) ADD_CUSTOM_COMMAND( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" - COMMAND ${_PYTHON_EXECUTABLE} + COMMAND ${LYX_PYTHON_EXECUTABLE} ARGS "${CMAKE_SOURCE_DIR}/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" DEPENDS ${_py_sources} ) diff --git a/development/cmake/src/CMakeLists.txt b/development/cmake/src/CMakeLists.txt index 8fbb254cc8..c17818f29c 100644 --- a/development/cmake/src/CMakeLists.txt +++ b/development/cmake/src/CMakeLists.txt @@ -58,8 +58,8 @@ else() endif() if (LYX_VLD) - configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY) - configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY) + configure_file(${LYX_VLD_PATH}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY) + configure_file(${LYX_VLD_PATH}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY) set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt) endif()