blob: 0a192b81e10c286b85113bad665a65d9ecf19425 (
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
|
cmake_minimum_required(VERSION 3.0)
project (xbase64)
set( xbase_VERSION_MAJOR 4 )
set( xbase_VERSION_MINOR 0 )
set( xbase_VERSION_PATCH 0 )
MESSAGE( "--- Xbase build for: " ${CMAKE_SYSTEM_NAME} )
MESSAGE( "--- Compiler: " ${CMAKE_CXX_COMPILER_ID} )
MESSAGE( "--- Project Name: " ${CMAKE_PROJECT_NAME} )
#Set compiler options
IF( CMAKE_COMPILER_IS_GNUCXX )
MESSAGE( "Setting GNU compiler options" )
add_compile_options( -Wall -Wsign-conversion )
# add_compile_options( -Wall -Wconversion -Wsign-conversion )
SET( VERBOSE 1 )
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
IF( BORLAND )
MESSAGE ("BORLAND COMPILER" )
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w-8022" )
add_compile_options( -w-8022 )
ENDIF( BORLAND )
MESSAGE( "--- Checking integer sizes" )
INCLUDE(CheckTypeSize)
CHECK_TYPE_SIZE( "short int" SHORT_INT )
CHECK_TYPE_SIZE( int INT )
CHECK_TYPE_SIZE( __int32 __INT32 )
CHECK_TYPE_SIZE( int32_t INT32_T )
CHECK_TYPE_SIZE( long LONG_INT )
CHECK_TYPE_SIZE( __int64 __INT64 )
CHECK_TYPE_SIZE( int64_t INT64_T )
CHECK_TYPE_SIZE( "long long" LONG_LONG )
CHECK_TYPE_SIZE( u_int64_t U_INT64_T )
CHECK_TYPE_SIZE( uint64_t UINT64_T )
CHECK_TYPE_SIZE( "unsigned __int64" UNSIGNED__INT64 )
CHECK_TYPE_SIZE( "unsigned long long" UNSIGNED_LONG_LONG )
CHECK_TYPE_SIZE( "double" DOUBLE )
MESSAGE( "--- Double size = " ${DOUBLE} )
#determine how 16 bit integer defined on this platform
SET( iSize 0 )
IF( HAVE_SHORT_INT AND ${SHORT_INT} EQUAL 2 )
SET( xbInt16 "short int" )
SET( xbUInt16 "unsigned short int" )
SET( iSize ${SHORT_INT} )
MESSAGE( "--- xbInt16 = [short int]" )
MESSAGE( "--- xbUInt16 = [unsigned short int]" )
ENDIF( HAVE_SHORT_INT AND ${SHORT_INT} EQUAL 2 )
IF( NOT ${iSize} EQUAL 2 )
MESSAGE( "FATAL_ERROR Could not detect 16 bit integer type" )
MESSAGE( ${iSize} )
RETURN()
ENDIF( NOT ${iSize} EQUAL 2 )
#determine how 32 bit integer defined on this platform
SET( iSize 0 )
IF( HAVE_INT AND ${INT} EQUAL 4 )
SET( xbInt32 int )
SET( xbUInt32 "unsigned int" )
SET( iSize ${INT} )
MESSAGE( "--- xbInt32 = [int]" )
MESSAGE( "--- xbUInt32 = [unsigned int]" )
ENDIF( HAVE_INT AND ${INT} EQUAL 4 )
IF(( NOT iSize EQUAL 4 ) AND HAVE___INT32 )
MESSAGE( __int untested if block - see CMakeLists.txt)
SET( xbInt32 __int32 )
SET( xbUInt32 "unsigned __int32" )
SET( iSize ${__INT} )
MESSAGE( "--- xbInt32 = [__int]" )
MESSAGE( "--- xbUInt32 = [unsigned __int]" )
ENDIF(( NOT iSize EQUAL 4 ) AND HAVE___INT32 )
IF(( NOT iSize EQUAL 4 ) AND HAVE_INT32_T )
SET( xbInt32 int32_t )
SET( xbUInt32 "u_int32_t" )
SET( iSize ${INT32_T} )
MESSAGE( "--- xbInt32 = [int32_t]" )
MESSAGE( "--- xbUInt32 = [u_int32_t]" )
ENDIF(( NOT iSize EQUAL 4 ) AND HAVE_INT32_T )
IF( NOT ${iSize} EQUAL 4 )
MESSAGE( "FATAL_ERROR Could not detect 32 bit integer type" )
MESSAGE( ${iSize} )
RETURN()
ENDIF( NOT ${iSize} EQUAL 4 )
#determine how 64 bit integer defined on this platform
SET( iSize 0 )
IF( HAVE___INT64 )
SET( xbInt64 __int64 )
SET( iSize ${__INT64} )
MESSAGE( "--- xbInt64 = [__int64]" )
ENDIF( HAVE___INT64 )
IF(( NOT iSize EQUAL 8 ) AND HAVE_INT64_T )
SET( xbInt64 int64_t )
SET( iSize ${INT64_T} )
MESSAGE( "--- xbInt64 = [int64_t]" )
ENDIF(( NOT iSize EQUAL 8 ) AND HAVE_INT64_T )
IF(( NOT iSize EQUAL 8 ) AND HAVE_LONG_LONG )
SET( xbInt64 "long long" )
SET( iSize ${LONG_LONG} )
MESSAGE( "--- xbInt64 = [long long]" )
ENDIF(( NOT iSize EQUAL 8 ) AND HAVE_LONG_LONG )
IF( NOT ${iSize} EQUAL 8 )
MESSAGE( "FATAL_ERROR Could not detect 64 bit integer type" )
MESSAGE( ${iSize} )
RETURN()
ENDIF( NOT ${iSize} EQUAL 8 )
#determine how 64 bit unsigned integer defined on this platform
SET( iSize 0 )
IF( HAVE_UNSIGNED__INT64 )
SET( xbUInt64 "unsigned __int64" )
SET( iSize ${UNSIGNED__INT64} )
MESSAGE( "--- xbUInt64 = [unsigned __int64]" )
ENDIF( HAVE_UNSIGNED__INT64 )
IF(( NOT iSize EQUAL 8 ) AND HAVE_UINT64_T )
SET( xbUInt64 "uint64_t" )
SET( iSize ${UINT64_T} )
MESSAGE( "--- xbUInt64 = [uint64_t]" )
ENDIF(( NOT iSize EQUAL 8 ) AND HAVE_UINT64_T )
IF(( NOT iSize EQUAL 8 ) AND HAVE_U_INT64_T )
SET( xbUInt64 u_int64_t )
SET( iSize ${U_INT64_T} )
MESSAGE( "--- xbUInt64 = [u_int64_t]" )
ENDIF(( NOT iSize EQUAL 8 ) AND HAVE_U_INT64_T )
IF(( NOT iSize EQUAL 8 ) AND HAVE_UNSIGNED_LONG_LONG )
SET( xbUInt64 "unsigned long long" )
SET( iSize ${UNSIGNED_LONG_LONG} )
MESSAGE( "--- xbUInt64 = [unsigned long long]" )
ENDIF(( NOT iSize EQUAL 8 ) AND HAVE_UNSIGNED_LONG_LONG )
IF( NOT ${iSize} EQUAL 8 )
MESSAGE( "FATAL_ERROR Could not detect 64 bit unsigned integer type" )
MESSAGE( ${iSize} )
RETURN()
ENDIF( NOT ${iSize} EQUAL 8 )
#Library options
option( BUILD_SHARED_LIBS "Build shared libraries?" ON)
option( XB_DEBUG_SUPPORT "Compile debug logic into library?" ON)
option( XB_UTILS_SUPPORT "Compile utility programs?" ON)
option( XB_EXAMPLES_SUPPORT "Compile example programs?" ON)
option( XB_MEMO_SUPPORT "Compile memo field support into library?" ON)
option( XB_LOGGING_SUPPORT "Compile message logging support into library" ON)
option( XB_DBF3_SUPPORT "Compile DBase File Format Version 3 support" ON)
option( XB_DBF4_SUPPORT "Compile DBase File Format Version 4 support" ON)
option( XB_LINKLIST_SUPPORT "Compile Link List routines into library" ON)
option( XB_LOCKING_SUPPORT "Compile Multi User Locking support into library" ON)
option( XB_FUNCTION_SUPPORT "Compile XBase Function support into library" ON)
option( XB_EXPRESSION_SUPPORT "Compile Expression support into library" ON)
option( XB_NDX_SUPPORT "Compile NDX Index support into library" ON)
option( XB_MDX_SUPPORT "Compile MDX Index support into library" ON)
option( XB_SQL_SUPPORT "Compile SQL support into library" ON)
option( XB_NDXINF_SUPPORT "Compile NDX INF file support into library" ON)
option( XB_FILTER_SUPPORT "Compile Filter support into library" ON)
Message( "--- BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
Message( "--- XB_MEMO_SUPPORT " ${XB_MEMO_SUPPORT})
Message( "--- XB_DEBUG_SUPPORT " ${XB_DEBUG_SUPPORT})
Message( "--- XB_UTILS_SUPPORT " ${XB_UTILS_SUPPORT})
Message( "--- XB_EXAMPLES_SUPPORT " ${XB_EXAMPLES_SUPPORT})
Message( "--- XB_LOGGING_SUPPORT " ${XB_LOGGING_SUPPORT})
Message( "--- XB_DBF3_SUPPORT " ${XB_DBF3_SUPPORT})
Message( "--- XB_DBF4_SUPPORT " ${XB_DBF4_SUPPORT})
Message( "--- XB_LINKLIST_SUPPORT " ${XB_LINKLIST_SUPPORT})
Message( "--- XB_LOCKING_SUPPORT " ${XB_LOCKING_SUPPORT})
Message( "--- XB_FUNCTION_SUPPORT " ${XB_FUNCTION_SUPPORT})
Message( "--- XB_EXPRESSION_SUPPORT " ${XB_EXPRESSION_SUPPORT})
Message( "--- XB_NDX_SUPPORT " ${XB_EXPRESSION_SUPPORT})
Message( "--- XB_MDX_SUPPORT " ${XB_EXPRESSION_SUPPORT})
Message( "--- XB_SQL_SUPPORT " ${XB_EXPRESSION_SUPPORT})
Message( "--- XB_NDXINF_SUPPORT " ${XB_NDXINF_SUPPORT})
Message( "--- XB_FILTER_SUPPORT " ${XB_FILTER_SUPPORT})
IF( XB_DEBUG_SUPPORT )
Message( "--- Adding debug support" )
set( CMAKE_BUILD_TYPE Debug )
IF( CMAKE_COMPILER_IS_GNUCXX )
add_compile_options( -Og )
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
ENDIF( XB_DEBUG_SUPPORT )
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "--- 64 bit compiler detected" )
set( XB_PLATFORM "x64" )
set( XB_PLATFORM_64 1 )
set( XB_LIBNAME "xbase64" )
ELSE( CMAKE_SIZEOF_VOID_P EQUAL 8 )
MESSAGE( "--- 32 bit compiler detected" )
set( XB_PLATFORM "x86" )
set( XB_PLATFORM_32 1 )
set( XB_LIBNAME "xbase32" )
ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
#Check for the existence of various header files
INCLUDE (CheckIncludeFiles)
CHECK_INCLUDE_FILES (ctype.h HAVE_CTYPE_H)
CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H)
CHECK_INCLUDE_FILES (fcntl.h HAVE_FCNTL_H)
CHECK_INCLUDE_FILES (inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES (stdarg.h HAVE_STDARG_H)
CHECK_INCLUDE_FILES (stdargs.h HAVE_STDARGS_H)
CHECK_INCLUDE_FILES (string.h HAVE_STRING_H)
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_STAT_H)
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES (varargs.h HAVE_VARARGS_H)
CHECK_INCLUDE_FILES (windows.h HAVE_WINDOWS_H)
#Check for the existence of various function calls
INCLUDE( CheckFunctionExists )
CHECK_FUNCTION_EXISTS(_close HAVE__CLOSE_F)
CHECK_FUNCTION_EXISTS(fcntl HAVE_FCNTL_F)
CHECK_FUNCTION_EXISTS(_fdopen HAVE__FDOPEN_F)
CHECK_FUNCTION_EXISTS(fopen_s HAVE_FOPEN_S_F)
CHECK_FUNCTION_EXISTS(_fsopen HAVE__FSOPEN_F)
CHECK_FUNCTION_EXISTS(_fileno HAVE__FILENO_F)
CHECK_FUNCTION_EXISTS(fork HAVE_FORK_F)
CHECK_FUNCTION_EXISTS(_fseeki64 HAVE__FSEEKI64_F)
CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO_F)
CHECK_FUNCTION_EXISTS(ftruncate HAVE_FTRUNCATE_F)
CHECK_FUNCTION_EXISTS(_localtime64_s HAVE__LOCALTIME64_S_F)
CHECK_FUNCTION_EXISTS(LockFile HAVE_LOCKFILE_F)
CHECK_FUNCTION_EXISTS(locking HAVE_LOCKING_F)
CHECK_FUNCTION_EXISTS(_locking HAVE__LOCKING_F)
CHECK_FUNCTION_EXISTS(_open HAVE__OPEN_F)
CHECK_FUNCTION_EXISTS(SetEndOfFile HAVE_SETENDOFFILE_F)
CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF_F)
CHECK_FUNCTION_EXISTS(_vsnprintf_s HAVE__VSNPRINTF_S_F)
IF( WIN32 )
# Use CHECK_SYMBOL_EXISTS for the Win32API instead of CHECK_FUNCTION_EXISTS
# Can't detect inline functions in headers
# Can't detect due to mismatch of calling conventions
# Can't detect mangled names
INCLUDE( CheckSymbolExists )
CHECK_SYMBOL_EXISTS(CreateProcessW Windows.h HAVE_CREATEPROCESSW_F )
CHECK_SYMBOL_EXISTS(vsprintf_s stdio.h HAVE_VSPRINTF_S_F )
ENDIF ( WIN32 )
# IF( NOT HAVE_SENTENDOFFILE_F AND NOT HAVE_FTRUNCATE_F AND BORLAND )
# # ----fix me----
# # cmake CHECK_FUNCTION_EXISTS - could not find Borland 5.5 SetEndOfFile
# Set( HAVE_SETENDOFFILE_F "HAVE_SETENDOFFILE_H" )
# ENDIF ( NOT HAVE_SENTENDOFFILE_F AND NOT HAVE_FTRUNCATE_F AND BORLAND )
IF( NOT HAVE_SETENDOFFILE_F AND NOT HAVE_FTRUNCATE_F AND WIN32 )
# ----fix me----
# cmake CHECK_FUNCTION_EXISTS - could not find Borland 5.5, or Windows VS 32 bit SetEndOfFile
Set( HAVE_SETENDOFFILE_F "HAVE_SETENDOFFILE_F" )
ENDIF ( NOT HAVE_SETENDOFFILE_F AND NOT HAVE_FTRUNCATE_F AND WIN32 )
IF( XB_NDX_SUPPORT OR XB_MDX_SUPPORT )
Set( XB_INDEX_SUPPORT "1" )
ENDIF( XB_NDX_SUPPORT OR XB_MDX_SUPPORT )
# Set directories
# PROJECT_PARENT_DIR is two nodes higher
get_filename_component( PROJECT_PARENT_DIR ${PROJECT_BINARY_DIR} DIRECTORY )
get_filename_component( PROJECT_PARENT_DIR ${PROJECT_PARENT_DIR} DIRECTORY )
# MESSAGE( "PROJECT_PARENT_DIR = " ${PROJECT_PARENT_DIR} )
# MESSAGE( "PROJECT_BINARY_DIR = " ${PROJECT_BINARY_DIR} )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${XB_PLATFORM})
set( LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/${XB_PLATFORM})
set( PROJECT_SOURCE_DIR ${PROJECT_PARENT_DIR}/src)
set( PROJECT_DATA_DIR ${PROJECT_PARENT_DIR}/data/)
set( PROJECT_LOG_DIR ${PROJECT_PARENT_DIR}/logs/)
set( EXTRA_LIBS ${EXTRA_LIBS} ${XB_LIBNAME})
# Undo bad decisions
IF( XB_PLATFORM_32 AND XB_LARGEFILE_SUPPORT )
MESSAGE( "--- Can't build 64 bit environment with a 32 bit compiler" )
MESSAGE( "--- XB_LARGEFILE_SUPPORT set to OFF" )
set( XB_LARGEFILE_SUPPORT OFF CACHE BOOL "Use 64 bit large file support?" FORCE )
ENDIF ( XB_PLATFORM_32 AND XB_LARGEFILE_SUPPORT )
IF( NOT XB_DBF3_SUPPORT AND NOT XB_DBF4_SUPPORT )
MESSAGE( "--- At lease one file format is required. Defaulting to Version 4" )
set( XB_DBF4_SUPPORT ON CACHE BOOL "Compile DBase File Format Version 4 support" FORCE )
ENDIF( NOT XB_DBF3_SUPPORT AND NOT XB_DBF4_SUPPORT )
IF( XB_DBF_SUPPORT AND XB_MEMO_SUPPORT AND NOT XB_LINKLIST_SUPPORT )
MESSAGE( "--- Link List support required for DBF V4 Memo files. Setting to ON" )
set( XB_LINKLIST_SUPPORT ON CACHE BOOL "Compile Link List routines into library" FORCE )
ENDIF( XB_DBF_SUPPORT AND XB_MEMO_SUPPORT AND NOT XB_LINKLIST_SUPPORT )
IF( XB_LOCKING_SUPPORT AND NOT XB_LINKLIST_SUPPORT )
MESSAGE( "--- Link List support required for locking functions. Setting to ON" )
set( XB_LINKLIST_SUPPORT ON CACHE BOOL "Compile Link List routines into library" FORCE )
ENDIF( XB_LOCKING_SUPPORT AND NOT XB_LINKLIST_SUPPORT )
IF( XB_INDEX_SUPPORT AND NOT XB_EXPRESSION_SUPPORT )
MESSAGE( "--- Expression required for indices. Setting to ON" )
set( XB_EXPRESSION_SUPPORT ON CACHE BOOL "Compile Expression support into library" FORCE )
ENDIF( XB_INDEX_SUPPORT AND NOT XB_EXPRESSION_SUPPORT )
IF( XB_EXPRESSION_SUPPORT AND NOT XB_FUNCTION_SUPPORT )
MESSAGE( "--- Function support required for expressions. Setting to ON" )
set( XB_FUNCTION_SUPPORT ON CACHE BOOL "Compile XBase Function support into library" FORCE )
ENDIF( XB_EXPRESSION_SUPPORT AND NOT XB_FUNCTION_SUPPORT )
IF( XB_EXPRESSION_SUPPORT AND NOT XB_LINKLIST_SUPPORT )
MESSAGE( "--- Function support required for expressions. Setting to ON" )
set( XB_LINKLIST_SUPPORT ON CACHE BOOL "Compile Link List routines into library" FORCE )
ENDIF( XB_EXPRESSION_SUPPORT AND NOT XB_LINKLIST_SUPPORT )
# Build configuration header file
configure_file (
"${PROJECT_SOURCE_DIR}/include/xbconfig.h.in"
"${PROJECT_BINARY_DIR}/include/xbconfig.h"
)
# Microsoft Windows settings
IF( WIN32 )
# add_definitions( /D_CRT_SECURE_NO_WARNINGS)
add_definitions( /EHsc )
ENDIF( WIN32 )
# set up include directories
include_directories( "${PROJECT_BINARY_DIR}/include" )
include_directories( "${PROJECT_SOURCE_DIR}/include" )
#build the library
IF ( BUILD_SHARED_LIBS )
set( LIB_TYPE SHARED )
ELSE( BUILD_SHARED_LIBS )
set( LIB_TYPE STATIC )
ENDIF( BUILD_SHARED_LIBS )
MESSAGE( "--- Lib type " ${LIB_TYPE} )
set (SOURCES ${PROJECT_SOURCE_DIR}/core/xbstring.cpp
${PROJECT_SOURCE_DIR}/core/xbssv.cpp
${PROJECT_SOURCE_DIR}/core/xbdate.cpp
${PROJECT_SOURCE_DIR}/core/xbtblmgr.cpp
${PROJECT_SOURCE_DIR}/core/xbxbase.cpp
${PROJECT_SOURCE_DIR}/core/xbfile.cpp
${PROJECT_SOURCE_DIR}/core/xbdbf.cpp
${PROJECT_SOURCE_DIR}/core/xbfields.cpp
${PROJECT_SOURCE_DIR}/core/xblog.cpp)
IF( XB_MEMO_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbmemo.cpp )
ENDIF( XB_MEMO_SUPPORT )
IF( XB_DBF3_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbdbf3.cpp )
IF( XB_MEMO_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbmemo3.cpp )
ENDIF( XB_MEMO_SUPPORT )
ENDIF( XB_DBF3_SUPPORT )
IF( XB_DBF4_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbdbf4.cpp )
IF( XB_MEMO_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbmemo4.cpp )
ENDIF( XB_MEMO_SUPPORT )
ENDIF( XB_DBF4_SUPPORT )
IF( XB_FUNCTION_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbfuncs.cpp )
ENDIF( XB_FUNCTION_SUPPORT )
IF( XB_EXPRESSION_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbexpnode.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbexp.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbuda.cpp )
ENDIF( XB_EXPRESSION_SUPPORT )
IF( XB_INDEX_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbbcd.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbixbase.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbtag.cpp )
ENDIF( XB_INDEX_SUPPORT )
IF( XB_NDX_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbixndx.cpp )
ENDIF( XB_NDX_SUPPORT )
IF( XB_MDX_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbixmdx.cpp )
ENDIF( XB_MDX_SUPPORT )
IF( XB_SQL_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbsql.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbinsert.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbcrtbl.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbcrix.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbdrpix.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbdrptbl.cpp )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/sql/xbset.cpp )
ENDIF( XB_SQL_SUPPORT )
IF( XB_FILTER_SUPPORT )
set (SOURCES ${SOURCES} ${PROJECT_SOURCE_DIR}/core/xbfilter.cpp )
ENDIF( XB_FILTER_SUPPORT )
include( GenerateExportHeader )
#add_library( xbase ${LIB_TYPE} ${SOURCES} )
add_library( ${XB_LIBNAME} ${LIB_TYPE} ${SOURCES} )
#add_library( ${CMAKE_PROJECT_NAME} ${LIB_TYPE} ${SOURCES} )
IF( WIN32 )
MESSAGE( "--- Generating Windows Library Headers" )
#GENERATE_EXPORT_HEADER( xbase
# BASE_NAME xbase
GENERATE_EXPORT_HEADER( ${XB_LIBNAME}
BASE_NAME ${XB_LIBNAME}
EXPORT_MACRO_NAME xbase_EXPORT
EXPORT_FILE_NAME xbase_Export.h
STATIC_DEFINE xbase_BUILT_AS_STATIC
)
ENDIF( WIN32 )
#build test programs
enable_testing()
add_executable( xb_test_string ${PROJECT_SOURCE_DIR}/tests/xb_test_string.cpp )
target_link_libraries( xb_test_string ${EXTRA_LIBS})
add_test( NAME xbString COMMAND xb_test_string QUIET )
add_executable( xb_test_date ${PROJECT_SOURCE_DIR}/tests/xb_test_date.cpp )
target_link_libraries( xb_test_date ${EXTRA_LIBS})
add_test( NAME xbDate COMMAND xb_test_date QUIET )
add_executable( xb_test_tblmgr ${PROJECT_SOURCE_DIR}/tests/xb_test_tblmgr.cpp )
target_link_libraries( xb_test_tblmgr ${EXTRA_LIBS})
add_test( NAME xbTblMgr COMMAND xb_test_tblmgr QUIET )
add_executable( xb_test_xbase ${PROJECT_SOURCE_DIR}/tests/xb_test_xbase.cpp )
target_link_libraries( xb_test_xbase ${EXTRA_LIBS})
add_test( NAME xbXBase COMMAND xb_test_xbase QUIET )
add_executable( xb_test_file ${PROJECT_SOURCE_DIR}/tests/xb_test_file.cpp )
target_link_libraries( xb_test_file ${EXTRA_LIBS})
add_test( NAME xbFile COMMAND xb_test_file QUIET )
add_executable( xb_test_log ${PROJECT_SOURCE_DIR}/tests/xb_test_log.cpp )
target_link_libraries( xb_test_log ${EXTRA_LIBS})
add_test( NAME xbLog COMMAND xb_test_log QUIET )
IF( XB_LINKLIST_SUPPORT )
add_executable( xb_test_linklist ${PROJECT_SOURCE_DIR}/tests/xb_test_linklist.cpp )
target_link_libraries( xb_test_linklist ${EXTRA_LIBS})
add_test( NAME xbLinkList COMMAND xb_test_linklist QUIET )
ENDIF( XB_LINKLIST_SUPPORT )
IF( XB_DBF3_SUPPORT )
add_executable( xb_test_dbf_v3_nomemos ${PROJECT_SOURCE_DIR}/tests/xb_test_dbf_v3_nomemos.cpp )
target_link_libraries( xb_test_dbf_v3_nomemos ${EXTRA_LIBS})
add_test( NAME xbDbfV3NoMemos COMMAND xb_test_dbf_v3_nomemos QUIET )
IF( XB_MEMO_SUPPORT )
add_executable( xb_test_dbf_v3_memos ${PROJECT_SOURCE_DIR}/tests/xb_test_dbf_v3_memos.cpp )
target_link_libraries( xb_test_dbf_v3_memos ${EXTRA_LIBS})
add_test( NAME xbDbfV3Memos COMMAND xb_test_dbf_v3_memos QUIET )
ENDIF( XB_MEMO_SUPPORT )
ENDIF( XB_DBF3_SUPPORT )
IF( XB_DBF4_SUPPORT )
add_executable( xb_test_dbf_v4_nomemos ${PROJECT_SOURCE_DIR}/tests/xb_test_dbf_v4_nomemos.cpp )
target_link_libraries( xb_test_dbf_v4_nomemos ${EXTRA_LIBS})
add_test( NAME xbDbfV4NoMemos COMMAND xb_test_dbf_v4_nomemos QUIET )
IF( XB_MEMO_SUPPORT )
add_executable( xb_test_dbf_v4_memos ${PROJECT_SOURCE_DIR}/tests/xb_test_dbf_v4_memos.cpp )
target_link_libraries( xb_test_dbf_v4_memos ${EXTRA_LIBS})
add_test( NAME xbDbfV4Memos COMMAND xb_test_dbf_v4_memos QUIET )
ENDIF( XB_MEMO_SUPPORT )
ENDIF( XB_DBF4_SUPPORT )
IF( XB_FUNCTION_SUPPORT )
add_executable( xb_test_funcs ${PROJECT_SOURCE_DIR}/tests/xb_test_funcs.cpp )
target_link_libraries( xb_test_funcs ${EXTRA_LIBS})
add_test( NAME xbFunctions COMMAND xb_test_funcs QUIET )
ENDIF( XB_FUNCTION_SUPPORT )
IF( XB_NDX_SUPPORT )
add_executable( xb_test_ndx ${PROJECT_SOURCE_DIR}/tests/xb_test_ndx.cpp )
target_link_libraries( xb_test_ndx ${EXTRA_LIBS})
add_test( NAME xbIxNdx COMMAND xb_test_ndx QUIET )
add_executable( xb_test_ndx2 ${PROJECT_SOURCE_DIR}/tests/xb_test_ndx2.cpp )
target_link_libraries( xb_test_ndx2 ${EXTRA_LIBS})
add_test( NAME xbIxNdx2 COMMAND xb_test_ndx2 QUIET )
ENDIF( XB_NDX_SUPPORT )
IF( XB_MDX_SUPPORT )
add_executable( xb_test_mdx ${PROJECT_SOURCE_DIR}/tests/xb_test_mdx.cpp )
target_link_libraries( xb_test_mdx ${EXTRA_LIBS})
add_test( NAME xbIxMdx COMMAND xb_test_mdx QUIET )
ENDIF( XB_MDX_SUPPORT )
IF( XB_INDEX_SUPPORT )
add_executable( xb_test_bcd ${PROJECT_SOURCE_DIR}/tests/xb_test_bcd.cpp )
target_link_libraries( xb_test_bcd ${EXTRA_LIBS})
add_test( NAME xbBcd COMMAND xb_test_bcd QUIET )
ENDIF( XB_INDEX_SUPPORT )
IF( XB_EXPRESSION_SUPPORT )
add_executable( xb_test_expnode ${PROJECT_SOURCE_DIR}/tests/xb_test_expnode.cpp )
target_link_libraries( xb_test_expnode ${EXTRA_LIBS})
add_test( NAME xbExpNode COMMAND xb_test_expnode QUIET )
add_executable( xb_test_expression ${PROJECT_SOURCE_DIR}/tests/xb_test_expression.cpp )
target_link_libraries( xb_test_expression ${EXTRA_LIBS})
add_test( NAME xbExpressions COMMAND xb_test_expression QUIET )
add_executable( xb_test_uda ${PROJECT_SOURCE_DIR}/tests/xb_test_uda.cpp )
target_link_libraries( xb_test_uda ${EXTRA_LIBS})
add_test( NAME xbUda COMMAND xb_test_uda QUIET )
ENDIF( XB_EXPRESSION_SUPPORT )
IF( XB_SQL_SUPPORT )
add_executable( xb_test_sql ${PROJECT_SOURCE_DIR}/tests/xb_test_sql.cpp )
target_link_libraries( xb_test_sql ${EXTRA_LIBS})
add_test( NAME xbSql COMMAND xb_test_sql QUIET )
ENDIF( XB_SQL_SUPPORT )
IF( XB_FILTER_SUPPORT )
add_executable( xb_test_filter ${PROJECT_SOURCE_DIR}/tests/xb_test_filter.cpp )
target_link_libraries( xb_test_filter ${EXTRA_LIBS})
add_test( NAME xbFilter COMMAND xb_test_filter QUIET )
ENDIF( XB_FILTER_SUPPORT )
IF( XB_LOCKING_SUPPORT )
add_executable( xb_test_lock ${PROJECT_SOURCE_DIR}/tests/xb_test_lock.cpp )
target_link_libraries( xb_test_lock ${EXTRA_LIBS})
add_test( NAME xbLock COMMAND xb_test_lock QUIET )
IF( HAVE_CREATEPROCESSW_F )
add_executable( xb_test_lock2 ${PROJECT_SOURCE_DIR}/tests/xb_test_lock2.cpp )
target_link_libraries( xb_test_lock2 ${EXTRA_LIBS})
ENDIF( HAVE_CREATEPROCESSW_F )
ENDIF( XB_LOCKING_SUPPORT )
#build example programs
IF( XB_EXAMPLES_SUPPORT )
add_executable( xb_ex_string ${PROJECT_SOURCE_DIR}/examples/xb_ex_string.cpp )
target_link_libraries( xb_ex_string ${EXTRA_LIBS})
add_executable( xb_ex_date ${PROJECT_SOURCE_DIR}/examples/xb_ex_date.cpp )
target_link_libraries( xb_ex_date ${EXTRA_LIBS})
IF( XB_DBF3_SUPPORT )
add_executable( xb_ex_v3_create_dbf ${PROJECT_SOURCE_DIR}/examples/xb_ex_v3_create_dbf.cpp )
target_link_libraries( xb_ex_v3_create_dbf ${EXTRA_LIBS})
add_executable( xb_ex_v3_upd_dbf ${PROJECT_SOURCE_DIR}/examples/xb_ex_v3_upd_dbf.cpp )
target_link_libraries( xb_ex_v3_upd_dbf ${EXTRA_LIBS})
ENDIF( XB_DBF3_SUPPORT )
IF( XB_DBF4_SUPPORT )
add_executable( xb_ex_v4_create_dbf ${PROJECT_SOURCE_DIR}/examples/xb_ex_v4_create_dbf.cpp )
target_link_libraries( xb_ex_v4_create_dbf ${EXTRA_LIBS})
add_executable( xb_ex_v4_upd_dbf ${PROJECT_SOURCE_DIR}/examples/xb_ex_v4_upd_dbf.cpp )
target_link_libraries( xb_ex_v4_upd_dbf ${EXTRA_LIBS})
ENDIF( XB_DBF4_SUPPORT )
ENDIF( XB_EXAMPLES_SUPPORT )
#build utility programs
IF( XB_UTILS_SUPPORT )
add_executable( xb_cfg_check ${PROJECT_SOURCE_DIR}/utils/xb_cfg_check.cpp )
target_link_libraries( xb_cfg_check ${EXTRA_LIBS})
add_executable( xb_copydbf ${PROJECT_SOURCE_DIR}/utils/xb_copydbf.cpp )
target_link_libraries( xb_copydbf ${EXTRA_LIBS})
add_executable( xb_dbfutil ${PROJECT_SOURCE_DIR}/utils/xb_dbfutil.cpp )
target_link_libraries( xb_dbfutil ${EXTRA_LIBS})
add_executable( xb_deletall ${PROJECT_SOURCE_DIR}/utils/xb_deletall.cpp )
target_link_libraries( xb_deletall ${EXTRA_LIBS})
add_executable( xb_dumpdbt ${PROJECT_SOURCE_DIR}/utils/xb_dumpdbt.cpp )
target_link_libraries( xb_dumpdbt ${EXTRA_LIBS})
add_executable( xb_dumphdr ${PROJECT_SOURCE_DIR}/utils/xb_dumphdr.cpp )
target_link_libraries( xb_dumphdr ${EXTRA_LIBS})
add_executable( xb_dumprecs ${PROJECT_SOURCE_DIR}/utils/xb_dumprecs.cpp )
target_link_libraries( xb_dumprecs ${EXTRA_LIBS})
add_executable( xb_tblinfo ${PROJECT_SOURCE_DIR}/utils/xb_tblinfo.cpp )
target_link_libraries( xb_tblinfo ${EXTRA_LIBS})
IF( XB_SQL_SUPPORT )
add_executable( xb_execsql ${PROJECT_SOURCE_DIR}/utils/xb_execsql.cpp )
target_link_libraries( xb_execsql ${EXTRA_LIBS})
ENDIF( XB_SQL_SUPPORT )
add_executable( xb_pack ${PROJECT_SOURCE_DIR}/utils/xb_pack.cpp )
target_link_libraries( xb_pack ${EXTRA_LIBS})
add_executable( xb_undelall ${PROJECT_SOURCE_DIR}/utils/xb_undelall.cpp )
target_link_libraries( xb_undelall ${EXTRA_LIBS})
add_executable( xb_zap ${PROJECT_SOURCE_DIR}/utils/xb_zap.cpp )
target_link_libraries( xb_zap ${EXTRA_LIBS})
install (TARGETS xb_cfg_check DESTINATION bin)
install (TARGETS xb_copydbf DESTINATION bin)
install (TARGETS xb_dbfutil DESTINATION bin)
install (TARGETS xb_deletall DESTINATION bin)
install (TARGETS xb_dumpdbt DESTINATION bin)
install (TARGETS xb_dumphdr DESTINATION bin)
install (TARGETS xb_dumprecs DESTINATION bin)
install (TARGETS xb_pack DESTINATION bin)
install (TARGETS xb_undelall DESTINATION bin)
install (TARGETS xb_zap DESTINATION bin)
install (TARGETS xb_execsql DESTINATION bin)
ENDIF( XB_UTILS_SUPPORT )
install (FILES include/xbconfig.h
${PROJECT_SOURCE_DIR}/include/xbase.h
${PROJECT_SOURCE_DIR}/include/xbbcd.h
${PROJECT_SOURCE_DIR}/include/xbdate.h
${PROJECT_SOURCE_DIR}/include/xbdbf.h
${PROJECT_SOURCE_DIR}/include/xbexp.h
${PROJECT_SOURCE_DIR}/include/xbexpnode.h
${PROJECT_SOURCE_DIR}/include/xbfile.h
${PROJECT_SOURCE_DIR}/include/xbindex.h
${PROJECT_SOURCE_DIR}/include/xblnklst.h
${PROJECT_SOURCE_DIR}/include/xblnklstord.h
${PROJECT_SOURCE_DIR}/include/xblnknod.h
${PROJECT_SOURCE_DIR}/include/xblog.h
${PROJECT_SOURCE_DIR}/include/xbmemo.h
${PROJECT_SOURCE_DIR}/include/xbretcod.h
${PROJECT_SOURCE_DIR}/include/xbsql.h
${PROJECT_SOURCE_DIR}/include/xbssv.h
${PROJECT_SOURCE_DIR}/include/xbstring.h
${PROJECT_SOURCE_DIR}/include/xbtblmgr.h
${PROJECT_SOURCE_DIR}/include/xbtypes.h
${PROJECT_SOURCE_DIR}/include/xbxbase.h
${PROJECT_SOURCE_DIR}/include/xbuda.h
${PROJECT_SOURCE_DIR}/include/xbtag.h
${PROJECT_SOURCE_DIR}/include/xbfilter.h
DESTINATION include/${CMAKE_PROJECT_NAME})
SET_TARGET_PROPERTIES( ${XB_LIBNAME} PROPERTIES VERSION 1.0.0 SOVERSION 0 )
#SET_TARGET_PROPERTIES( ${CMAKE_PROJECT_NAME} PROPERTIES VERSION 1.0.0 SOVERSION 0 )
IF( EXISTS /usr/local/lib64 )
install (TARGETS ${XB_LIBNAME} DESTINATION lib64/${CMAKE_PROJECT_NAME})
ELSE( EXISTS /usr/local/lib64 )
install (TARGETS ${XB_LIBNAME} DESTINATION lib/${CMAKE_PROJECT_NAME})
ENDIF( EXISTS /usr/local/lib64 )
|