@@ -7,6 +7,15 @@ project(cql2cpp
7
7
)
8
8
add_definitions (-DVERSION= "${PROJECT_VERSION} " )
9
9
10
+ find_package (SQLite3 QUIET )
11
+ find_package (libspatialite QUIET )
12
+
13
+ if (SQLite3_FOUND AND libspatialite_FOUND )
14
+ set (SQLITE_LIBS SQLite::SQLite3 libspatialite::libspatialite )
15
+ else ()
16
+ set (SQLITE_LIBS sqlite3 spatialite )
17
+ endif ()
18
+
10
19
find_package (GTest REQUIRED )
11
20
find_package (geos REQUIRED )
12
21
find_package (glog REQUIRED )
@@ -52,11 +61,13 @@ set(CQL2CPP_SRC
52
61
add_library (cql2cpp ${CQL2CPP_SRC} )
53
62
target_compile_options (cql2cpp PRIVATE -Wno-register -Wno-write-strings )
54
63
target_link_libraries (cql2cpp GEOS::geos glog::glog )
64
+ install (TARGETS cql2cpp LIBRARY DESTINATION lib/ )
55
65
56
66
# CLI tool
57
67
add_executable (cql2 src/main.cc )
58
68
target_compile_options (cql2 PRIVATE -Wno-register -Wno-write-strings )
59
69
target_link_libraries (cql2 cql2cpp GEOS::geos glog::glog )
70
+ install (TARGETS cql2 RUNTIME DESTINATION lib/${PROJECT_NAME}/ )
60
71
61
72
# Test
62
73
enable_testing ()
@@ -71,5 +82,5 @@ target_link_libraries(test_bbox_reader GTest::GTest GTest::Main glog::glog GEOS:
71
82
add_test (NAME test_bbox_reader COMMAND test_bbox_reader WORKING_DIRECTORY ${TEST_DIR} )
72
83
73
84
add_executable (test_sql ${TEST_DIR} /test_sql.cc )
74
- target_link_libraries (test_sql cql2cpp GTest::GTest GTest::Main glog::glog sqlite3 spatialite )
85
+ target_link_libraries (test_sql cql2cpp GTest::GTest GTest::Main glog::glog ${SQLITE_LIBS} )
75
86
add_test (NAME test_sql COMMAND test_sql WORKING_DIRECTORY ${TEST_DIR} )
0 commit comments