@@ -7,6 +7,15 @@ project(cql2cpp
77)
88add_definitions (-DVERSION="${PROJECT_VERSION} " )
99
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+
1019find_package (GTest REQUIRED)
1120find_package (geos REQUIRED)
1221find_package (glog REQUIRED)
@@ -52,11 +61,13 @@ set(CQL2CPP_SRC
5261add_library (cql2cpp ${CQL2CPP_SRC} )
5362target_compile_options (cql2cpp PRIVATE -Wno-register -Wno-write-strings )
5463target_link_libraries (cql2cpp GEOS::geos glog::glog)
64+ install (TARGETS cql2cpp LIBRARY DESTINATION lib/)
5565
5666# CLI tool
5767add_executable (cql2 src/main.cc)
5868target_compile_options (cql2 PRIVATE -Wno-register -Wno-write-strings )
5969target_link_libraries (cql2 cql2cpp GEOS::geos glog::glog)
70+ install (TARGETS cql2 RUNTIME DESTINATION lib/${PROJECT_NAME} /)
6071
6172# Test
6273enable_testing ()
@@ -71,5 +82,5 @@ target_link_libraries(test_bbox_reader GTest::GTest GTest::Main glog::glog GEOS:
7182add_test (NAME test_bbox_reader COMMAND test_bbox_reader WORKING_DIRECTORY ${TEST_DIR} )
7283
7384add_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} )
7586add_test (NAME test_sql COMMAND test_sql WORKING_DIRECTORY ${TEST_DIR} )
0 commit comments