summaryrefslogtreecommitdiffstats
path: root/scribus/CMakeLists.txt
blob: 8503d6c4b1dd472a9aa5ba22668eee6133d32974 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
IF(WIN32)
  ADD_DEFINITIONS(-DQT_DLL)
ENDIF(WIN32)

ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(dtd)
ADD_SUBDIRECTORY(manpages)
ADD_SUBDIRECTORY(colormgmt)
ADD_SUBDIRECTORY(profiles)
ADD_SUBDIRECTORY(styles)
ADD_SUBDIRECTORY(text)
ADD_SUBDIRECTORY(fonts)
ADD_SUBDIRECTORY(desaxe)
ADD_SUBDIRECTORY(unicodemap)
IF (WANT_DESIGNER)
  ADD_SUBDIRECTORY(designer)
ENDIF (WANT_DESIGNER)

SET(SCRIBUS_UI_SRC
  aboutplugins.ui
  aligndistribute.ui
  charselect.ui
  charselectenhanced.ui
  cmsprefsbase.ui
  docitemattrprefs.ui
  docsections.ui
  gtfiledialog.ui
  guidemanager.ui
  hysettingsBase.ui
  insertaframe.ui
  latexeditor.ui
  measurementsbase.ui
  multipleduplicate.ui
  multiprogressdialog.ui
  nftdialog.ui
  nftwidget.ui
  pageitemattributes.ui
  patterndialog.ui
  picsearch.ui
  picsearchoptions.ui
  picstatus.ui
  pluginmanagerprefsgui.ui
  polygonwidgetbase.ui
  printdialogbase.ui
  replacecolors.ui
  replaceonecolor.ui
  selectobjects.ui
  shortcutwidget.ui
  smcstylewidget.ui
  smlinestylewidget.ui
  smpstylewidget.ui
  smreplacedia.ui
  smstyleimport.ui
  stylemanager.ui
  tabdisplay.ui
  tabexternaltoolswidget.ui
  tabgeneral.ui
  tabkeyboardshortcutswidget.ui
  tabmiscellaneous.ui
  tabprinter.ui
  tabscrapbook.ui
  tocindexprefs.ui
  ui/copypagetomasterpage.ui
  ui/createrange.ui
  ui/downloaddictionaries.ui
  ui/helpbrowser.ui
  unicodesearch.ui
  useprintermarginsdialog.ui
)

SET(SCRIBUS_MOC_CLASSES
  about.h
  aboutplugins.h
  actionmanager.h
  adjustcmsdialog.h
  aligndistribute.h
  alignselect.h
  annot.h
  annota.h
  applytemplatedialog.h
  arrowchooser.h
  autoform.h
  autoformbuttongroup.h
  basepointwidget.h
  bookmarkpalette.h
  bookmwin.h
  buttonicon.h
  canvas.h
  canvasgesture_rulermove.h
  canvasmode.h
  canvasmode_edit.h
  canvasmode_legacy.h
  canvasmode_measurements.h
  canvasmode_normal.h
  charselect.h
  charselectenhanced.h
  chartablemodel.h
  chartableview.h
  charzoom.h
  checkDocument.h
  cmsprefs.h
  cmykfw.h
  collect4output.h
  colorblind.h
  colorchart.h
  colorcombo.h
  colorlistbox.h
  colorm.h
  commonstrings.h
  contextmenu.h
  cpalette.h
  cupsoptions.h
  curvewidget.h
  customfdialog.h
  dasheditor.h
  dcolor.h
  deferredtask.h
  delpages.h
  docinfo.h
  docitemattrprefs.h
  docsections.h
  downloadmanager/scdlmgr.h
  downloadmanager/scdlthread.h
  editor.h
  effectsdialog.h
  extimageprops.h
  fileloader.h
  filesearch.h
  filewatcher.h
  fontcombo.h
  fontlistmodel.h
  fontlistview.h
  fontprefs.h
  fontreplacedialog.h
  gradienteditor.h
  gtdialogs.h
  gtfiledialog.h
  guidemanager.h
  guidesdelegate.h
  guidesmodel.h
  helpbrowser.h
  hruler.h
  hyask.h
  hyphenator.h
  hysettings.h
  imageinfodialog.h
  insertTable.h
  insertaframe.h
  inspage.h
  javadocs.h
  latexeditor.h
  latexhelpers.h
  layers.h
  loadsaveplugin.h
  loremipsum.h
  marginwidget.h
  margindialog.h
  masterpagepalette.h
  measurements.h
  menumanager.h
  mergedoc.h
  missing.h
  movepage.h
  multipleduplicate.h
  multiprogressdialog.h
  navigator.h
  newfile.h
  newtemp.h
  nftdialog.h
  nftwidget.h
  nodeeditpalette.h
  observable.h
  oneclick.h
  outlinepalette.h
  pageitem.h
  pageitem_imageframe.h
  pageitem_latexframe.h
  pageitem_line.h
  pageitem_pathtext.h
  pageitem_polygon.h
  pageitem_polyline.h
  pageitem_textframe.h
  pageitemattributes.h
  pageitempointer.h
  pagelayout.h
  pagepalette.h
  pageselector.h
  patterndialog.h
  pdflib.h
  pdflib_core.h
  pdfopts.h
  picsearch.h
  picsearchoptions.h
  picstatus.h
  pluginmanager.h
  pluginmanagerprefsgui.h
  polygonwidget.h
  polyprops.h
  prefs.h
  prefsdialogbase.h
  prefsmanager.h
  prefspanel.h
  preview.h
  printdialog.h
  propertiespalette.h
  pslib.h
  query.h
  reformdoc.h
  replacecolors.h
  replaceonecolor.h
  rulermover.h
  sampleitem.h
  scfilewidget.h
  scgtplugin.h
  schelptreemodel.h
  scinputdialog.h
  scmenu.h
  scmessagebox.h
  scplugin.h
  scprintengine.h
  scraction.h
  scrapbookpalette.h
  scribus.h
  scribusapp.h
  scribuscore.h
  scribusdoc.h
  scribusview.h
  scribuswin.h
  scrpalettebase.h
  scrspinbox.h
  sctablewidget.h
  sctextbrowser.h
  sctoolbar.h
  sctreewidget.h
  search.h
  selection.h
  selectobjects.h
  selfield.h
  shadebutton.h
  shortcutwidget.h
  smalignselect.h
  smcheckbox.h
  smcolorcombo.h
  smcstylewidget.h
  smfontcomboh.h
  smlinestyle.h
  smlinestylewidget.h
  smpstylewidget.h
  smreplacedia.h
  smsccombobox.h
  smscrspinbox.h
  smshadebutton.h
  smspinbox.h
  smstyleimport.h
  smstyleselect.h
  smtabruler.h
  smtextstyles.h
  spalette.h
  storyeditor.h
  styleitem.h
  stylemanager.h
  styleselect.h
  styleview.h
  tabcheckdoc.h
  tabdisplay.h
  tabdocument.h
  tabexternaltoolswidget.h
  tabgeneral.h
  tabguides.h
  tabkeyboardshortcutswidget.h
  tabmanager.h
  tabmiscellaneous.h
  tabpdfoptions.h
  tabprinter.h
  tabruler.h
  tabscrapbook.h
  tabtools.h
  tabtypography.h
  tocgenerator.h
  tocindexprefs.h
  tt/simpletreemodel/treemodel.h
  ui/copypagetomasterpagedialog.h
  ui/createrange.h
  ui/downloaddictionaries.h
  ui/edittoolbar.h
  ui/filetoolbar.h  
  ui/modetoolbar.h
  ui/pdftoolbar.h
  undogui.h
  undomanager.h
  unicodesearch.h
  upgradechecker.h
  urllauncher.h
  useprintermarginsdialog.h
  vruler.h
)

SET(SCRIBUS_SOURCES
  about.cpp
  aboutplugins.cpp
  actionmanager.cpp
  adjustcmsdialog.cpp
  aligndistribute.cpp
  alignselect.cpp
  annot.cpp
  annota.cpp
  annotation.cpp
  applytemplatedialog.cpp
  arrowchooser.cpp
  autoform.cpp
  autoformbuttongroup.cpp
  basepointwidget.cpp
  bookmarkpalette.cpp
  bookmwin.cpp
  buttonicon.cpp
  canvas.cpp
  canvasgesture_linemove.cpp
  canvasgesture_pan.cpp
  canvasgesture_rectselect.cpp
  canvasgesture_resize.cpp
  canvasgesture_rulermove.cpp
  canvasmode.cpp
  canvasmode_copyproperties.cpp
  canvasmode_create.cpp
  canvasmode_drawbezier.cpp
  canvasmode_drawfreehand.cpp
  canvasmode_eyedropper.cpp
  canvasmode_framelinks.cpp
  canvasmode_edit.cpp
  canvasmode_editgradient.cpp
  canvasmode_legacy.cpp
  canvasmode_magnifier.cpp
  canvasmode_measurements.cpp
  canvasmode_nodeedit.cpp
  canvasmode_normal.cpp
  canvasmode_objimport.cpp
  canvasmode_panning.cpp
  canvasmode_rotate.cpp
  charselect.cpp
  charselectenhanced.cpp
  chartablemodel.cpp
  chartableview.cpp
  charzoom.cpp
  checkDocument.cpp
  cmserrorhandling.cpp
  cmsettings.cpp
  cmsprefs.cpp
  cmykfw.cpp
  collect4output.cpp
  colorblind.cpp
  colorchart.cpp
  colorcombo.cpp
  colorlistbox.cpp
  colorm.cpp
  colorsetmanager.cpp
  commonstrings.cpp
  contextmenu.cpp
  cpalette.cpp
  cupsoptions.cpp
  curvewidget.cpp
  customfdialog.cpp
  dasheditor.cpp
  dcolor.cpp
  deferredtask.cpp
  delpages.cpp
  docinfo.cpp
  docitemattrprefs.cpp
  docsections.cpp
  documentchecker.cpp
  documentinformation.cpp
  downloadmanager/scdlmgr.cpp
  downloadmanager/scdlthread.cpp
  editor.cpp
  effectsdialog.cpp
  exif.cpp
  extimageprops.cpp
  fileloader.cpp
  filesearch.cpp
  fileunzip.cpp
  filewatcher.cpp
  fontcombo.cpp
  fontlistmodel.cpp
  fontlistview.cpp
  fontprefs.cpp
  fontreplacedialog.cpp
  fparser.cpp
  fpoint.cpp
  fpointarray.cpp
  fpoptimizer.cpp
  gradienteditor.cpp
  gtaction.cpp
  gtdialogs.cpp
  gtfiledialog.cpp
  gtfont.cpp
  gtframestyle.cpp
  gtgettext.cpp
  gtmeasure.cpp
  gtparagraphstyle.cpp
  gtstyle.cpp
  gtwriter.cpp
  guidemanager.cpp
  guidemanagercore.cpp
  guidesdelegate.cpp
  guidesmodel.cpp
  helpbrowser.cpp
  hruler.cpp
  hyask.cpp
  hyphenator.cpp
  hysettings.cpp
  imageinfodialog.cpp
  insertTable.cpp
  insertaframe.cpp
  inspage.cpp
  ioapi.c
  javadocs.cpp
  KarbonCurveFit.cpp
  langmgr.cpp
  latexeditor.cpp
  latexhelpers.cpp
  layers.cpp
  linecombo.cpp
  linkbutton.cpp
  loadsaveplugin.cpp
  loremipsum.cpp
  marginwidget.cpp
  margindialog.cpp
  masterpagepalette.cpp
  measurements.cpp
  menumanager.cpp
  mergedoc.cpp
  missing.cpp
  movepage.cpp
  multipleduplicate.cpp
  multiprogressdialog.cpp
  navigator.cpp
  newfile.cpp
  newtemp.cpp
  nftdialog.cpp
  nftwidget.cpp
  nftrcreader.cpp
  nftsettings.cpp
  nfttemplate.cpp
  nodeeditpalette.cpp
  observable.cpp
  oneclick.cpp
  outlinepalette.cpp
  page.cpp
  pageitem.cpp
  pageitem_desaxe.cpp
  pageitem_imageframe.cpp
  pageitem_latexframe.cpp
  pageitem_line.cpp
  pageitem_pathtext.cpp
  pageitem_polygon.cpp
  pageitem_polyline.cpp
  pageitem_textframe.cpp
  pageitemattributes.cpp
  pageitempointer.cpp
  pagelayout.cpp
  pagepalette.cpp
  pageselector.cpp
  pagesize.cpp
  patterndialog.cpp
  pdflib.cpp
  pdflib_core.cpp
  pdfoptions.cpp
  pdfoptionsio.cpp
  pdfopts.cpp
  picsearch.cpp
  picsearchoptions.cpp
  picstatus.cpp
  pluginmanager.cpp
  pluginmanagerprefsgui.cpp
  polygonwidget.cpp
  polyprops.cpp
  prefs.cpp
  prefscontext.cpp
  prefsdialogbase.cpp
  prefsfile.cpp
  prefsmanager.cpp
  prefspanel.cpp
  prefsreader.cpp
  prefstable.cpp
  preview.cpp
  printdialog.cpp
  propertiespalette.cpp
  pslib.cpp
  query.cpp
  rawimage.cpp
  rc4.c
  reformdoc.cpp
  replacecolors.cpp
  replaceonecolor.cpp
  rulermover.cpp
  sampleitem.cpp
  scclocale.cpp
  sccolor.cpp
  sccolorengine.cpp
  sccolorshade.cpp
  sccombobox.cpp
  scdocoutput.cpp
  scdocoutput_ps2.cpp
  scfilewidget.cpp
  scfonts.cpp
  scgtplugin.cpp
  scgzfile.cpp
  schelptreemodel.cpp
  scimage.cpp
  scimagestructs.cpp
  scimgdataloader.cpp
  scimgdataloader_gimp.cpp
  scimgdataloader_jpeg.cpp
  scimgdataloader_pdf.cpp
  scimgdataloader_ps.cpp
  scimgdataloader_psd.cpp
  scimgdataloader_qt.cpp
  scimgdataloader_tiff.cpp
  scinputdialog.cpp
  sclayer.cpp
  scmenu.cpp
  scmessagebox.cpp
  scmimedata.cpp
  scpageoutput.cpp
  scpageoutput_ps2.cpp
  scpainter.cpp
  scpainterex_ps2.cpp
  scpainterexbase.cpp
  scpaths.cpp
  scpattern.cpp
  scplugin.cpp
  scpreview.cpp
  scprintengine_ps.cpp
  scraction.cpp
  scrapbookpalette.cpp
  scresizecursor.cpp
  scribus.cpp
  scribusXml.cpp
  scribusapp.cpp
  scribuscore.cpp
  scribusdoc.cpp
  scribusview.cpp
  scribuswin.cpp
  scrpalettebase.cpp
  scrspinbox.cpp
  scslainforeader.cpp
  scstreamfilter.cpp
  scstreamfilter_ascii85.cpp
  scstreamfilter_flate.cpp
  scstreamfilter_rc4.cpp
  sctablewidget.cpp
  sctextbrowser.cpp
  sctextstream.cpp
  sctextstruct.cpp
  sctoolbar.cpp
  sctreewidget.cpp
  search.cpp
  selection.cpp
  selectobjects.cpp
  selfield.cpp
  serializer.cpp
  shadebutton.cpp
  shortcutwidget.cpp
  smalignselect.cpp
  smcheckbox.cpp
  smcolorcombo.cpp
  smcstylewidget.cpp
  smfontcomboh.cpp
  smlinestyle.cpp
  smlinestylewidget.cpp
  smpstylewidget.cpp
  smradiobutton.cpp
  smreplacedia.cpp
  smsccombobox.cpp
  smscrspinbox.cpp
  smshadebutton.cpp
  smspinbox.cpp
  smstyleimport.cpp
  smstyleselect.cpp
  smtabruler.cpp
  smtextstyles.cpp
  spalette.cpp
  splash.cpp
  stencilreader.cpp
  storyeditor.cpp
  styleitem.cpp
  stylemanager.cpp
  styleselect.cpp
  styleview.cpp
  tabcheckdoc.cpp
  tabdisplay.cpp
  tabdocument.cpp
  tabexternaltoolswidget.cpp
  tabgeneral.cpp
  tabguides.cpp
  tabkeyboardshortcutswidget.cpp
  tabmanager.cpp
  tabmiscellaneous.cpp
  tabpdfoptions.cpp
  tabprinter.cpp
  tabruler.cpp
  tabscrapbook.cpp
  tabtools.cpp
  tabtypography.cpp
  tocgenerator.cpp
  tocindexprefs.cpp
  transaction.cpp
  tt/simpletreemodel/treeitem.cpp
  tt/simpletreemodel/treemodel.cpp
  ui/copypagetomasterpagedialog.cpp
  ui/createrange.cpp
  ui/downloaddictionaries.cpp
  ui/edittoolbar.cpp
  ui/filetoolbar.cpp
  ui/modetoolbar.cpp
  ui/pdftoolbar.cpp
  undogui.cpp
  undomanager.cpp
  undoobject.cpp
  undostack.cpp
  undostate.cpp
  unicodesearch.cpp
  units.cpp
  unzip.c
  updatemanager.cpp
  upgradechecker.cpp
  urllauncher.cpp
  useprintermarginsdialog.cpp
  util.cpp
  util_color.cpp
  util_file.cpp
  util_formats.cpp
  util_ghostscript.cpp
  util_icon.cpp
  util_math.cpp
  util_printer.cpp
  util_text.cpp
  vgradient.cpp
  vgradientex.cpp
  vruler.cpp
)

IF(NOT HAVE_HYPHEN)
  SET(SCRIBUS_SOURCES
    ${SCRIBUS_SOURCES}
    hnjalloc.c
    hyphen.c
  )
ENDIF(NOT HAVE_HYPHEN)

IF(WIN32)
  SET(SCRIBUS_MOC_WIN32_ONLY_CLASSES scprintengine_gdi.h)
  SET(SCRIBUS_WIN32_ONLY_SOURCES
      scpainterex_cairo.cpp
      scprintengine_gdi.cpp
      )
  SET(SCRIBUS_MAIN_CPP main_win32.cpp)
ELSE(WIN32)
  SET(SCRIBUS_MOC_WIN32_ONLY_CLASSES)
  SET(SCRIBUS_WIN32_ONLY_SOURCES)
  SET(SCRIBUS_MAIN_CPP main.cpp)
ENDIF(WIN32)

QT4_WRAP_UI(SCRIBUS_UI_SOURCES ${SCRIBUS_UI_SRC} )

QT4_WRAP_CPP(SCRIBUS_MOC_SOURCES
	${SCRIBUS_MOC_CLASSES}
	${SCRIBUS_MOC_WIN32_ONLY_CLASSES}
	)

LINK_DIRECTORIES(
  ${CMAKE_CURRENT_BINARY_DIR}/colormgmt
  ${CMAKE_CURRENT_BINARY_DIR}/desaxe
  ${CMAKE_CURRENT_BINARY_DIR}/text
  ${CMAKE_CURRENT_BINARY_DIR}/styles
  ${CMAKE_CURRENT_BINARY_DIR}/fonts
)

SET(SCRIBUS_COLORMGMT_LIB "scribus_colormgmt_lib")
SET(SCRIBUS_TEXT_LIB "scribus_text_lib")
SET(SCRIBUS_STYLES_LIB "scribus_styles_lib")
SET(SCRIBUS_FONTS_LIB "scribus_fonts_lib")
SET(SCRIBUS_DESAXE_LIB "scribus_desaxe_lib")

INCLUDE_DIRECTORIES(
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${FREETYPE_INCLUDE_DIRS}
)

IF(HAVE_PODOFO)
  INCLUDE_DIRECTORIES(
    ${LIBPODOFO_INCLUDE_DIR}
    )
ENDIF(HAVE_PODOFO)

IF(GESTURE_FRAME_PREVIEW)
   MESSAGE(STATUS "Enable gesture frame preview [experimental]")
   SET(GESTURE_FRAME_PREVIEW_SOURCES  pageitempreview.cpp)
   ADD_DEFINITIONS(-DGESTURE_FRAME_PREVIEW)
ENDIF(GESTURE_FRAME_PREVIEW)

IF(APPLEBUNDLE)
  SET(EXE_NAME "Scribus${TAG_VERSION}" CACHE TYPE STRING)
ELSE(APPLEBUNDLE)
  SET(EXE_NAME "scribus${TAG_VERSION}" CACHE TYPE STRING)
ENDIF(APPLEBUNDLE)

IF(COMMAND cmake_policy)
  cmake_policy(SET CMP0003 OLD)
ENDIF(COMMAND cmake_policy)

ADD_EXECUTABLE(${EXE_NAME}
  ${SCRIBUS_MOC_SOURCES}
  ${SCRIBUS_SOURCES}
  ${SCRIBUS_MAIN_CPP}
  ${SCRIBUS_UI_SOURCES}
  ${SCRIBUS_TEXT_SOURCES}
  ${SCRIBUS_STYLES_SOURCES}
  ${SCRIBUS_COLORMGMT_SOURCES}
  ${SCRIBUS_FONTS_SOURCES}
  ${SCRIBUS_DESAXE_SOURCES}
  ${SCRIBUS_WIN32_ONLY_SOURCES}
  ${GESTURE_FRAME_PREVIEW_SOURCES}
)

IF(WIN32)
  SET_TARGET_PROPERTIES(${EXE_NAME}
	PROPERTIES
	COMPILE_FLAGS -DCOMPILE_SCRIBUS_MAIN_APP
	ENABLE_EXPORTS TRUE
	)
  SET(WIN32_ONLY_LIBS mscms.lib)
ELSE(WIN32)
  SET(WIN32_ONLY_LIBS)
ENDIF(WIN32)

##TEST FIX FOR 6897
IF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
# Use the -E / --export-dynamic flag to ensure that symbols in the Scribus
# binary are in the public symbol table for plugins. The symbols must also
# be set as SCRIBUS_API if we're building with -fvisibility=hidden .
# Should fix bug 6897 .
  SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES LINK_FLAGS -Wl,-E)
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
IF (GCC AND NOT WIN32)
# Use the -E / --export-dynamic flag to ensure that symbols in the Scribus
# binary are in the public symbol table for plugins. The symbols must also
# be set as SCRIBUS_API if we're building with -fvisibility=hidden .
# Should fix bug 6897 .
  SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES LINK_FLAGS -Wl,-E)
ENDIF (GCC AND NOT WIN32)
##

#Set up libraries to link with all found packages

#Select Libart_LGPL or Cairo
IF(RENDER_LIB STREQUAL "CAIRO")
  INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIR})
  TARGET_LINK_LIBRARIES(${EXE_NAME} ${CAIRO_LIBRARIES})
  LINK_DIRECTORIES(${PREFIX_CAIRO_LIB})
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${PREFIX_CAIRO_LIB}")
ENDIF(RENDER_LIB STREQUAL "CAIRO")

MESSAGE("RPATH: ${CMAKE_INSTALL_RPATH}")

TARGET_LINK_LIBRARIES(${EXE_NAME}
  ${QT_LIBRARIES}
  ${CUPS_LIBRARIES}
  ${FREETYPE_LIBRARIES}
  ${FONTCONFIG_LIBRARIES}
  ${LIBXML2_LIBRARIES}
  ${PYTHON_LIBRARIES}
  ${TIFF_LIBRARIES}
  ${JPEG_LIBRARIES}
  ${ZLIB_LIBRARIES}
  ${WIN32_ONLY_LIBS}
)

# required to resolve symbols from libdl when ld is called with --no-add-needed
# #9310 for the OpenBSD addition
IF(UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
  TARGET_LINK_LIBRARIES(${EXE_NAME} dl)
ENDIF(UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")

# #9311 for the OpenBSD addition
IF(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
  TARGET_LINK_LIBRARIES(${EXE_NAME} util execinfo)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")

IF(WIN32)
  TARGET_LINK_LIBRARIES(${EXE_NAME} ${QT_QTMAIN_LIBRARY})
ENDIF(WIN32)

IF(APPLE)
  TARGET_LINK_LIBRARIES(${EXE_NAME}
    "-undefined dynamic_lookup"
    "-framework CoreFoundation" )
ENDIF(APPLE)

TARGET_LINK_LIBRARIES(${EXE_NAME}
  ${SCRIBUS_COLORMGMT_LIB}
  ${SCRIBUS_DESAXE_LIB}
  ${SCRIBUS_TEXT_LIB}
  ${SCRIBUS_STYLES_LIB}
  ${SCRIBUS_FONTS_LIB}
  ${LCMS_LIBRARIES}
)

IF(HAVE_PODOFO)
  TARGET_LINK_LIBRARIES(${EXE_NAME}
    ${LIBPODOFO_LIBRARY}
  )
ENDIF(HAVE_PODOFO)

IF(HAVE_HYPHEN)
  TARGET_LINK_LIBRARIES(${EXE_NAME}
    ${HYPHEN_LIBRARY}
  )
ENDIF(HAVE_HYPHEN)

# Now build plugins
SET(PLUGIN_LIBRARIES
  ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}
  ${LIBXML2_LIBRARIES}
  ${ZLIB_LIBRARIES}
)
IF(WIN32)
  # IF your plugin needs more than this, please link them privately
  # in the CMakeLists.txt for your plugin.
  SET(PLUGIN_LIBRARIES
#    ${QT_LIBRARIES} part of #7210
    ${PLUGIN_LIBRARIES}
    ${EXE_NAME}
    )
ENDIF(WIN32)
IF(APPLE)
  SET(PLUGIN_LIBRARIES
    ${PLUGIN_LIBRARIES}
    "-undefined dynamic_lookup"
  )
ENDIF(APPLE)

ADD_SUBDIRECTORY(plugins)

#do we want a lib suffix on osx? doubt it
IF(APPLEBUNDLE)
  INSTALL(DIRECTORY DESTINATION MacOS)
  INSTALL(TARGETS ${EXE_NAME}
    RUNTIME DESTINATION MacOS
    LIBRARY DESTINATION lib
    )
#  ADD_CUSTOM_COMMAND(TARGET ${EXE_NAME} POST_BUILD
#	COMMAND ${CMAKE_COMMAND} ARGS -Dinput_file=${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME}.app/Contents/MacOS/${EXE_NAME} -P ${CMAKE_MODULE_PATH}/ScribusIngestOSXBundleLibraries.cmake
#  )

#  INSTALL(
#	CODE "SET(input_file ${CMAKE_INSTALL_PREFIX}/MacOS/${EXE_NAME})"  
#	SCRIPT ${CMAKE_MODULE_PATH}/ScribusIngestOSXBundleLibraries.cmake )
ELSE(APPLEBUNDLE)
  IF(WIN32)
    INSTALL(TARGETS ${EXE_NAME}
      RUNTIME DESTINATION .
      LIBRARY DESTINATION ${LIB_DIR_NAME}
      )
  ELSE(WIN32)
    INSTALL(TARGETS ${EXE_NAME}
      RUNTIME DESTINATION bin
      LIBRARY DESTINATION ${LIB_DIR_NAME}
      )
  ENDIF(WIN32)
ENDIF(APPLEBUNDLE)

#Install our header files, selected from all existing dirs, excluding unwanted directories and svn files
IF(NOT WANT_NOHEADERINSTALL)
  MESSAGE(STATUS "Source header files will be installed")
  INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${INCLUDEDIR} 
    FILES_MATCHING 
    PATTERN "*.h"
    PATTERN "dicts" EXCLUDE
    PATTERN "doc" EXCLUDE
    PATTERN "dtd" EXCLUDE
    PATTERN "editorconfig" EXCLUDE
    PATTERN "icon*" EXCLUDE
    PATTERN "manpages" EXCLUDE
    PATTERN "old" EXCLUDE
    PATTERN ".svn" EXCLUDE 
  )
ELSE(NOT WANT_NOHEADERINSTALL)
  MESSAGE(STATUS "No source header files will be installed")
ENDIF(NOT WANT_NOHEADERINSTALL)