Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
122COM_sql/CMakeLists.txt
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46 lines (28 sloc)
1.35 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.2) | |
set(CMAKE_CXX_STANDARD 14) | |
project(sqlite) | |
set(CMAKE_CXX_FLAGS_DEBUG "-g") | |
set(CMAKE_CXX_FLAGS_RELEASE "-O3") | |
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) | |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin ) | |
# configure the shared paths | |
include_directories(${CMAKE_CURRENT_LIST_DIR}/include) | |
file(MAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lib) | |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lib) | |
# if you are on linux and have installed libsqlite3-dev | |
# using your package manager then this should work | |
add_executable(lec_dynamic src/lec_dynamic.cpp) | |
target_link_libraries(lec_dynamic sqlite3) | |
# a more reliable method but it needs the files in the | |
# cmake/FindSQLite3.cmake present | |
find_package(SQLite3) | |
include_directories(${SQLite3_INCLUDE_DIRS}) | |
add_executable(lec_single_insert src/lec_single_insert.cpp) | |
target_link_libraries(lec_single_insert ${SQLite3_LIBRARIES}) | |
# there are things that can be done to speed up compilation | |
# if only some of your programs need the sqlite3 library | |
# but this does start to compilcate your CMakeLists.txt file | |
find_package(SQLite3) # this line only needed once in a CMakeLists.txt file | |
add_executable(lec_select src/lec_select.cpp) | |
target_include_directories(lec_select PUBLIC ${SQLite3_INCLUDE_DIRS}) | |
target_link_libraries(lec_select ${SQLite3_LIBRARIES}) | |