cmake: add shared library support

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17599 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2007-03-27 18:26:36 +00:00
parent 46adcb162d
commit 5fc2e3efc8
8 changed files with 21 additions and 14 deletions

View File

@ -47,6 +47,7 @@ endif(merge OR MERGE_FILES)
set(CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE)
if(profile) if(profile)
set(CMAKE_BUILD_TYPE Profile CACHE TYPE STRING FORCE) 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) set(profile)
endif(profile) endif(profile)
if(release) if(release)
@ -57,6 +58,12 @@ if(debug)
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
endif(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(UNIX)
if(NOT quiet) if(NOT quiet)

View File

@ -19,10 +19,10 @@ lyx_add_msvc_pch(frontends)
if(NOT MERGE_FILES) 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) else(NOT MERGE_FILES)
lyx_merge_files(allinone frontends_sources) 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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -14,10 +14,10 @@ lyx_add_msvc_pch(controllers)
include_directories(${TOP_SRC_DIR}/src/frontends/controllers) include_directories(${TOP_SRC_DIR}/src/frontends/controllers)
if(NOT MERGE_FILES) 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) else(NOT MERGE_FILES)
lyx_merge_files(allinone controllers_sources) 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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -41,14 +41,14 @@ if(MERGE_FILES)
set(depends_moc_uic ${frontends_qt4_headers} ${ui_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_const.C PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
SET_SOURCE_FILES_PROPERTIES(allinone_touched.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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
${frontends_qt4_headers} ${frontends_qt4_headers}
${ui_files} ${ui_files}
) )
else(MERGE_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) endif(MERGE_FILES)
target_link_libraries(frontend_qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} controllers) target_link_libraries(frontend_qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} controllers)

View File

@ -15,10 +15,10 @@ lyx_add_msvc_pch(graphics)
include_directories(${TOP_SRC_DIR}/src/graphics) include_directories(${TOP_SRC_DIR}/src/graphics)
if(NOT MERGE_FILES) 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) else(NOT MERGE_FILES)
lyx_merge_files(allinone graphics_sources) 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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -17,10 +17,10 @@ include_directories(${TOP_SRC_DIR}/src/insets)
if(NOT MERGE_FILES) 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) else(NOT MERGE_FILES)
lyx_merge_files(allinone insets_sources) 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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -18,10 +18,10 @@ lyx_add_msvc_pch(mathed)
include_directories(${TOP_SRC_DIR}/src/mathed) include_directories(${TOP_SRC_DIR}/src/mathed)
if(NOT MERGE_FILES) 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) else(NOT MERGE_FILES)
lyx_merge_files(allinone mathed_sources) 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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES) endif(NOT MERGE_FILES)

View File

@ -27,7 +27,7 @@ lyx_add_msvc_pch(support)
include_directories(${TOP_SRC_DIR}/src/support ${ICONV_INCLUDE_DIR}) include_directories(${TOP_SRC_DIR}/src/support ${ICONV_INCLUDE_DIR})
if(NOT MERGE_FILES) 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) else(NOT MERGE_FILES)
# move to front # move to front
list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/convert.C) 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(APPEND support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
list(REVERSE support_sources) list(REVERSE support_sources)
lyx_merge_files(allinone 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_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C) ${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)