]> git.lyx.org Git - lyx.git/blobdiff - development/cmake/CMakeLists.txt
cmake: add shared library support
[lyx.git] / development / cmake / CMakeLists.txt
index 169a3b883bb8e15e2e71976e3f1e37eb1dea0b87..2c10af054b76a720620f241fd6359bc9ca23d09b 100644 (file)
@@ -4,7 +4,8 @@
 # Copyright (c) 2006, Peter Kümmel, <syntheticpp@gmx.net>
 #
 
-CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
+#not really needed
+#CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
 
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
@@ -42,10 +43,44 @@ if(merge OR MERGE_FILES)
        message(STATUS "")
 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)
        set(CMAKE_BUILD_TYPE Release)
        set(release)
-endif(release) 
+endif(release)
+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)
+               set(CMAKE_VERBOSE_MAKEFILE ON)
+       endif(NOT quiet)
+       set(LYX_CXX_FLAGS -Wall)
+       if(stdlib-debug)
+               set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
+       endif(stdlib-debug)
+       if(concept-checks)
+               set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCPP_CONCEPT_CHECKS")
+       endif(concept-checks)
+       set(CMAKE_CXX_FLAGS          "${LYX_CXX_FLAGS}" CACHE TYPE STRING FORCE)
+       set(CMAKE_CXX_FLAGS_DEBUG    "${LYX_CXX_FLAGS} -O -g -D_DEBUG" CACHE TYPE STRING FORCE)
+       set(CMAKE_CXX_FLAGS_RELEASE  "${LYX_CXX_FLAGS} -O3 -DNDEBUG" CACHE TYPE STRING FORCE)
+       set(CMAKE_CXX_FLAGS_PROFILE  "${CMAKE_CXX_FLAGS_RELEASE} -pg" CACHE TYPE STRING FORCE)
+endif(UNIX)
 
 
 set(qt_postfix qt4)
@@ -57,8 +92,6 @@ if(MERGE_FILES)
 endif(MERGE_FILES)
 
 find_package(ZLIB REQUIRED)
-find_package(ICONV REQUIRED)
-add_definitions(-DHAVE_ICONV=1)
 
 if(all OR aspell)
        set(aspell TRUE CACHE TYPE STRING)
@@ -196,6 +229,10 @@ endif(MSVC)
 include(ConfigureChecks.cmake)
 configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
 
+find_package(ICONV REQUIRED)
+add_definitions(-DHAVE_ICONV=1)
+
+
 #TODO: insource is not the best place
 configure_file(${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py.in 
                ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py)