diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 5340b6f7e1..c259f17b75 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -30,14 +30,26 @@ set(VERSION_INFO "CMake Build") include(LyXPaths) #called here to define the needed TOP_SRC_DIR-variable file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines) +if(WIN32) + set(USE_WINDOWS_PACKAGING 1) +elseif(APPLE) + set(USE_MACOSX_PACKAGING 1) +else() + set(USE_POSIX_PACKAGING 1) +endif() + macro(setstripped _varname _value) string(STRIP ${_value} _v) - set(${_varname} ${_v}) + if(USE_POSIX_PACKAGING) + string(TOLOWER ${_v} ${_varname}) + else() + set(${_varname} ${_v}) + endif() endmacro(setstripped) foreach(_c_l ${_config_lines} ) if(_c_l MATCHES "^AC_INIT\\(\([^,]+\),\([^,]+\),\([^,]+\)\(.*\)") - setstripped(PACKAGE_tmp ${CMAKE_MATCH_1}) + setstripped(PACKAGE_BASE ${CMAKE_MATCH_1}) setstripped(PACKAGE_VERSION ${CMAKE_MATCH_2}) if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\).*$") set(LYX_DIR_VER "LYX_DIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x") @@ -52,13 +64,14 @@ endforeach(_c_l) if(UseVersionSuffix) message("-- Using versioned PACKAGE. Disable with -DUseVersionSuffix=0") - set(PACKAGE ${PACKAGE_tmp}${LYX_INSTALL_SUFFIX}) + set(PACKAGE ${PACKAGE_BASE}${LYX_INSTALL_SUFFIX}) + set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}") else() message("-- PACKAGE not versioned, to enable use -DUseVersionSuffix=1") - set(PACKAGE ${PACKAGE_tmp}) + set(PACKAGE ${PACKAGE_BASE}) + set(PROGRAM_SUFFIX "") endif() -set(PROGRAM_SUFFIX "\"\"") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # see http://www.cmake.org/pipermail/cmake/2006-October/011559.html if (UNIX) @@ -79,14 +92,6 @@ set(LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_DATADIR}/${LYX_LOCALEDIR}") set(LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}") -if(WIN32) - set(USE_WINDOWS_PACKAGING 1) -elseif(APPLE) - set(USE_MACOSX_PACKAGING 1) -else() - set(USE_POSIX_PACKAGING 1) -endif() - if(NOT GROUP_CODE) #set(GROUP_CODE "The Golden Code") set(GROUP_CODE flat) diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index 5925421f06..17176b18b1 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -30,7 +30,7 @@ #cmakedefine LYX_DIR_VER "${LYX_DIR_VER}" #cmakedefine LYX_USERDIR_VER "${LYX_USERDIR_VER}" -#define PROGRAM_SUFFIX "${PPROGRAM_SUFFIX}" +#define PROGRAM_SUFFIX "${PROGRAM_SUFFIX}" #define LYX_ABS_INSTALLED_DATADIR "${LYX_ABS_INSTALLED_DATADIR}" #define LYX_ABS_INSTALLED_LOCALEDIR "${LYX_ABS_INSTALLED_LOCALEDIR}" #define LYX_ABS_TOP_SRCDIR "${TOP_SRC_DIR}" diff --git a/development/cmake/man/CMakeLists.txt b/development/cmake/man/CMakeLists.txt index 11f2506a6a..826cd504c9 100755 --- a/development/cmake/man/CMakeLists.txt +++ b/development/cmake/man/CMakeLists.txt @@ -10,7 +10,7 @@ project(man) SET(_manuals) macro(add_manual _mansrc) get_filename_component(_mandest ${_mansrc} NAME_WE) - SET(_created_manual "${CMAKE_CURRENT_BINARY_DIR}/${_mandest}.1") + SET(_created_manual "${CMAKE_CURRENT_BINARY_DIR}/${_mandest}${PROGRAM_SUFFIX}.1") configure_file("${TOP_SRC_DIR}/${_mansrc}" ${_created_manual} @ONLY) SET_SOURCE_FILES_PROPERTIES(${_created_manual} GENERATED) LIST(APPEND _manuals ${_created_manual}) diff --git a/development/cmake/src/CMakeLists.txt b/development/cmake/src/CMakeLists.txt index 8b99bc00c6..763755f170 100644 --- a/development/cmake/src/CMakeLists.txt +++ b/development/cmake/src/CMakeLists.txt @@ -4,7 +4,8 @@ # Copyright (c) 2006, Peter Kümmel, # -project(lyx) +set(_lyx ${PACKAGE_BASE}${PROGRAM_SUFFIX}) +project(${_lyx}) include_directories(${TOP_SRC_DIR}/src) @@ -52,14 +53,14 @@ if (LYX_LEAK_DETECTION) set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt) endif() -add_executable(lyx +add_executable(${_lyx} ${WIN32_CONSOLE} ${lyx_sources} ${lyx_headers} ${vld_files} ) -target_link_libraries(lyx +target_link_libraries(${_lyx} mathed insets frontends @@ -72,19 +73,19 @@ target_link_libraries(lyx ${vld_dll}) if (ASPELL_FOUND) - target_link_libraries(lyx ${ASPELL_LIBRARY}) + target_link_libraries(${_lyx} ${ASPELL_LIBRARY}) endif() if (APPLE) - target_link_libraries(lyx "-bind_at_load") - target_link_libraries(lyx "-framework Carbon") + target_link_libraries(${_lyx} "-bind_at_load") + target_link_libraries(${_lyx} "-framework Carbon") endif() if (MINGW) - target_link_libraries(lyx ole32) + target_link_libraries(${_lyx} ole32) endif() project_source_group("${GROUP_CODE}" lyx_sources lyx_headers) -install(TARGETS lyx DESTINATION bin) +install(TARGETS ${_lyx} DESTINATION bin) diff --git a/development/cmake/src/client/CMakeLists.txt b/development/cmake/src/client/CMakeLists.txt index 7e22a86130..f46a44d72c 100644 --- a/development/cmake/src/client/CMakeLists.txt +++ b/development/cmake/src/client/CMakeLists.txt @@ -5,7 +5,8 @@ # Copyright (c) 2008, 2009 Kornel Benko, # -project(lyxclient) +set(_lyxclient lyxclient${PROGRAM_SUFFIX}) +project(${_lyxclient}) file(GLOB _lyxclient_sources ${TOP_SRC_DIR}/src/client/*.cpp) file(GLOB _lyxclient_headers ${TOP_SRC_DIR}/src/client/*.h) @@ -14,10 +15,10 @@ list(REMOVE_ITEM _lyxclient_headers "${TOP_SRC_DIR}/src/client/pch.h") include_directories(BEFORE "${TOP_SRC_DIR}/src/client" "${TOP_SRC_DIR}/boost" ${ZLIB_INCLUDE_DIR}) -add_executable(lyxclient ${_lyxclient_sources} ${_lyxclient_headers}) +add_executable(${_lyxclient} ${_lyxclient_sources} ${_lyxclient_headers}) -target_link_libraries(lyxclient +target_link_libraries(${_lyxclient} support boost_regex ${LIBINTL_LIBRARIES} @@ -27,12 +28,12 @@ target_link_libraries(lyxclient ) if (ASPELL_FOUND) - target_link_libraries(lyxclient ${ASPELL_LIBRARY}) + target_link_libraries(${_lyxclient} ${ASPELL_LIBRARY}) endif() if (APPLE) - target_link_libraries(lyxclient "-framework Carbon") + target_link_libraries(${_lyxclient} "-framework Carbon") endif() -install(TARGETS lyxclient DESTINATION bin) +install(TARGETS ${_lyxclient} DESTINATION bin) diff --git a/development/cmake/src/tex2lyx/CMakeLists.txt b/development/cmake/src/tex2lyx/CMakeLists.txt index 476a1feac3..d2aa33064d 100644 --- a/development/cmake/src/tex2lyx/CMakeLists.txt +++ b/development/cmake/src/tex2lyx/CMakeLists.txt @@ -4,7 +4,8 @@ # Copyright (c) 2006, Peter Kümmel, # -project(tex2lyx) +set(_tex2lyx tex2lyx${PROGRAM_SUFFIX}) +project(${_tex2lyx}) set(LINKED_sources ${TOP_SRC_DIR}/src/insets/InsetLayout.cpp @@ -47,16 +48,16 @@ include_directories(BEFORE ${TOP_SRC_DIR}/src/tex2lyx add_definitions(-DTEX2LYX) if(NOT MERGE_FILES) - add_executable(tex2lyx ${tex2lyx_sources} ${LINKED_sources} + add_executable(${_tex2lyx} ${tex2lyx_sources} ${LINKED_sources} ${tex2lyx_headers} ${LINKED_headers}) else() lyx_const_touched_files(_allinone tex2lyx_sources) lyx_const_touched_files(_allinone_linked LINKED_sources) - add_executable(tex2lyx ${_allinone_files} ${_allinone_linked_files}) + add_executable(${_tex2lyx} ${_allinone_files} ${_allinone_linked_files}) endif() -target_link_libraries(tex2lyx +target_link_libraries(${_tex2lyx} support boost_regex ${QT_QTCORE_LIBRARY} @@ -64,14 +65,14 @@ target_link_libraries(tex2lyx ${ICONV_LIBRARY}) if(WIN32) - target_link_libraries(tex2lyx shlwapi ole32) + target_link_libraries(${_tex2lyx} shlwapi ole32) endif() if(APPLE) - target_link_libraries(tex2lyx "-framework Carbon") + target_link_libraries(${_tex2lyx} "-framework Carbon") endif() project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers) -install(TARGETS tex2lyx DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +install(TARGETS ${_tex2lyx} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)