diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index c190b0f212..2c10af054b 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -47,6 +47,7 @@ endif(merge OR MERGE_FILES) set(CMAKE_BUILD_TYPE) if(profile) set(CMAKE_BUILD_TYPE Profile CACHE TYPE STRING FORCE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" CACHE TYPE STRING FORCE) set(profile) endif(profile) if(release) @@ -57,6 +58,12 @@ if(debug) set(CMAKE_BUILD_TYPE Debug) endif(debug) +if(shared) + set(library_type SHARED) + message(STATUS "building shared libraries") +else(shared) + set(library_type STATIC) +endif(shared) if(UNIX) if(NOT quiet) diff --git a/development/cmake/src/frontends/CMakeLists.txt b/development/cmake/src/frontends/CMakeLists.txt index 4f1d234f5f..3072627d36 100644 --- a/development/cmake/src/frontends/CMakeLists.txt +++ b/development/cmake/src/frontends/CMakeLists.txt @@ -19,10 +19,10 @@ lyx_add_msvc_pch(frontends) if(NOT MERGE_FILES) - add_library(frontends STATIC ${frontends_sources} ${frontends_headers}) + add_library(frontends ${library_type} ${frontends_sources} ${frontends_headers}) else(NOT MERGE_FILES) lyx_merge_files(allinone frontends_sources) - add_library(frontends STATIC + add_library(frontends ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) endif(NOT MERGE_FILES) diff --git a/development/cmake/src/frontends/controllers/CMakeLists.txt b/development/cmake/src/frontends/controllers/CMakeLists.txt index 2c1517d4d6..09272911ee 100644 --- a/development/cmake/src/frontends/controllers/CMakeLists.txt +++ b/development/cmake/src/frontends/controllers/CMakeLists.txt @@ -14,10 +14,10 @@ lyx_add_msvc_pch(controllers) include_directories(${TOP_SRC_DIR}/src/frontends/controllers) if(NOT MERGE_FILES) - add_library(controllers STATIC ${controllers_sources} ${controllers_headers}) + add_library(controllers ${library_type} ${controllers_sources} ${controllers_headers}) else(NOT MERGE_FILES) lyx_merge_files(allinone controllers_sources) - add_library(controllers STATIC + add_library(controllers ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) endif(NOT MERGE_FILES) diff --git a/development/cmake/src/frontends/qt4/CMakeLists.txt b/development/cmake/src/frontends/qt4/CMakeLists.txt index d39ff3a0fc..46fadefb9c 100644 --- a/development/cmake/src/frontends/qt4/CMakeLists.txt +++ b/development/cmake/src/frontends/qt4/CMakeLists.txt @@ -41,14 +41,14 @@ if(MERGE_FILES) set(depends_moc_uic ${frontends_qt4_headers} ${ui_files}) SET_SOURCE_FILES_PROPERTIES(allinone_const.C PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}") SET_SOURCE_FILES_PROPERTIES(allinone_touched.C PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}") - add_library(frontend_qt4 STATIC + add_library(frontend_qt4 ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C ${frontends_qt4_headers} ${ui_files} ) else(MERGE_FILES) - add_library(frontend_qt4 STATIC ${frontends_qt4_sources} ${frontends_qt4_headers} ${ui_files}) + add_library(frontend_qt4 ${library_type} ${frontends_qt4_sources} ${frontends_qt4_headers} ${ui_files}) endif(MERGE_FILES) target_link_libraries(frontend_qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} controllers) diff --git a/development/cmake/src/graphics/CMakeLists.txt b/development/cmake/src/graphics/CMakeLists.txt index e6c2c2f1c7..55780f3311 100644 --- a/development/cmake/src/graphics/CMakeLists.txt +++ b/development/cmake/src/graphics/CMakeLists.txt @@ -15,10 +15,10 @@ lyx_add_msvc_pch(graphics) include_directories(${TOP_SRC_DIR}/src/graphics) if(NOT MERGE_FILES) - add_library(graphics STATIC ${graphics_sources} ${graphics_headers}) + add_library(graphics ${library_type} ${graphics_sources} ${graphics_headers}) else(NOT MERGE_FILES) lyx_merge_files(allinone graphics_sources) - add_library(graphics STATIC + add_library(graphics ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) endif(NOT MERGE_FILES) diff --git a/development/cmake/src/insets/CMakeLists.txt b/development/cmake/src/insets/CMakeLists.txt index 1e0fa5c6a6..fb62388b0f 100644 --- a/development/cmake/src/insets/CMakeLists.txt +++ b/development/cmake/src/insets/CMakeLists.txt @@ -17,10 +17,10 @@ include_directories(${TOP_SRC_DIR}/src/insets) if(NOT MERGE_FILES) - add_library(insets STATIC ${insets_sources} ${insets_headers}) + add_library(insets ${library_type} ${insets_sources} ${insets_headers}) else(NOT MERGE_FILES) lyx_merge_files(allinone insets_sources) - add_library(insets STATIC + add_library(insets ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) endif(NOT MERGE_FILES) diff --git a/development/cmake/src/mathed/CMakeLists.txt b/development/cmake/src/mathed/CMakeLists.txt index 3ba1de93d8..e5bfe39627 100644 --- a/development/cmake/src/mathed/CMakeLists.txt +++ b/development/cmake/src/mathed/CMakeLists.txt @@ -18,10 +18,10 @@ lyx_add_msvc_pch(mathed) include_directories(${TOP_SRC_DIR}/src/mathed) if(NOT MERGE_FILES) - add_library(mathed STATIC ${mathed_sources} ${mathed_headers}) + add_library(mathed ${library_type} ${mathed_sources} ${mathed_headers}) else(NOT MERGE_FILES) lyx_merge_files(allinone mathed_sources) - add_library(mathed STATIC + add_library(mathed ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) endif(NOT MERGE_FILES) diff --git a/development/cmake/src/support/CMakeLists.txt b/development/cmake/src/support/CMakeLists.txt index 70bac0afb8..cc6d09f8f4 100644 --- a/development/cmake/src/support/CMakeLists.txt +++ b/development/cmake/src/support/CMakeLists.txt @@ -27,7 +27,7 @@ lyx_add_msvc_pch(support) include_directories(${TOP_SRC_DIR}/src/support ${ICONV_INCLUDE_DIR}) if(NOT MERGE_FILES) - add_library(support STATIC ${support_sources} ${support_headers}) + add_library(support ${library_type} ${support_sources} ${support_headers}) else(NOT MERGE_FILES) # move to front list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/convert.C) @@ -36,7 +36,7 @@ else(NOT MERGE_FILES) list(APPEND support_sources ${TOP_SRC_DIR}/src/support/lstrings.C) list(REVERSE support_sources) lyx_merge_files(allinone support_sources) - add_library(support STATIC + add_library(support ${library_type} ${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)