summaryrefslogtreecommitdiff
path: root/editors/Sigil/patches/patch-CMakeLists.txt
blob: 71c8840d68382aa8866bc8f303428f652fbc8f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
$NetBSD: patch-CMakeLists.txt,v 1.4 2012/01/26 15:43:20 ryoon Exp $

* Use external libraries.
  http://code.google.com/p/sigil/source/detail?r=ac1642d3df17ee958ab573e1cdb284d60bad6f9a

--- CMakeLists.txt.orig	2012-01-21 00:31:22.000000000 +0000
+++ CMakeLists.txt
@@ -46,21 +46,81 @@ set( CMAKE_OSX_DEPLOYMENT_TARGET "10.6" 
 
 # 10.7 is the required minimum OS X version.
 set( CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" )
-
-# Universal builds for mac
 set( CMAKE_OSX_ARCHITECTURES "x86_64" )
 
 # This disables the building of the test runner app for FlightCrew
 set( NO_TEST_EXE 1 )
 
+if( NOT FORCE_BUNDLED_COPIES )
+    find_package( Boost COMPONENTS date_time filesystem program_options regex system thread )
+    find_package( ZLIB )
+    find_package( PkgConfig )
+    pkg_check_modules( ZIPARCHIVE ZipArchive>=4.1.1 )
+    pkg_check_modules( XERCES xerces-c>=3.1 )
+    pkg_check_modules( HUNSPELL hunspell )
+    if ( NOT APPLE )
+        pkg_check_modules( PCRE libpcre )
+    endif()
+endif()
+
+# We must use the bundled Tidy because there are Sigil
+# specific changes to it.
 add_subdirectory( src/tidyLib )
-add_subdirectory( src/ZipArchive )
-add_subdirectory( src/BoostParts )
-add_subdirectory( src/Xerces )
+
+if( FORCE_BUNDLED_COPIES OR NOT ZIPARCHIVE_FOUND )
+    add_subdirectory( src/ZipArchive )
+    set( ZIPARCHIVE_LIBRARIES ZipArchive )
+    set( ZIPARCHIVE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/ZipArchive )
+endif()
+
+if( FORCE_BUNDLED_COPIES OR NOT Boost_FOUND )
+    add_subdirectory( src/BoostParts )
+    # Set these so zipios doesn't complain.
+    set( Boost_DATE_TIME_LIBRARY 1 )
+    set( Boost_FILESYSTEM_LIBRARY 1 )
+    set( Boost_PROGRAM_OPTIONS_LIBRARY 1 )
+    set( Boost_REGEX_LIBRARY 1 )
+    set( Boost_SYSTEM_LIBRARY 1 )
+    set( Boost_THREAD_LIBRARY 1 )
+    set( BOOST_LIBS BoostParts )
+    set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
+else()
+    set( BOOST_LIBS ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} )
+    set( BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} )
+endif()
+
+if( FORCE_BUNDLED_COPIES OR NOT XERCES_FOUND )
+    add_subdirectory( src/Xerces )
+    set( XERCES_LIBRARIES Xerces )
+    set( XERCES_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/Xerces )
+endif()
+
+# XercesExtensions is not an external project. It is part of FlightCrew
+# and Sigil and it is not distributed as a standalone library.
 add_subdirectory( src/XercesExtensions )
-add_subdirectory( src/zlib )
+set( XERCESEXTENSIONS_LIBRARIES XercesExtensions )
+set( XERCESEXTENSIONS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/XercesExtensions )
+
+if( FORCE_BUNDLED_COPIES OR NOT ZLIB_FOUND )
+    add_subdirectory( src/zlib )
+endif()
+
+if( FORCE_BUNDLED_COPIES OR NOT PCRE_FOUND OR APPLE )
+    add_subdirectory( src/pcre )
+    set( PCRE_LIBRARIES pcre )
+    set( PCRE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/pcre )
+endif()
+
+if( FORCE_BUNDLED_COPIES OR NOT HUNSPELL_FOUND )
+    add_subdirectory( src/hunspell )
+    set( HUNSPELL_LIBRARIES hunspell )
+    set( HUNSPELL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/hunspell )
+endif()
+
+# FlightCrew
 add_subdirectory( src/zipios )
-add_subdirectory( src/pcre )
-add_subdirectory( src/hunspell )
 add_subdirectory( src/FlightCrew )
+set( FLIGHTCREW_LIBRARIES FlightCrew )
+set( FLIGHTCREW_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/FlightCrew )
+
 add_subdirectory( src/Sigil )