Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add BUILD_SHARED_LIBS instead of deprecated build of static and dynamic libs #1

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ Module.symvers
Mkfile.old
dkms.conf
build
/.vs
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ enable_language(C)
include(ExternalProject)

option(SQLITE3_WITH_SHELL "build sqlite3 executable" OFF)
option(SQLITE3_STATIC_LIB "build sqlite3 static library" ON)
option(SQLITE3_SHARED_LIB "build sqlite3 shared library" OFF)
option(BUILD_SHARED_LIBS "build sqlite3 shared or static library" OFF)
option(SQLITE3_USE_SHARED_CRT "use shared crt library" ON)
option(SQLITE3_ENABLE_MATH_FUNCTIONS "enable SQL math functions" ON)

Expand Down Expand Up @@ -64,22 +63,13 @@ add_custom_command(
DEPENDS sqlite3-src
)

add_library(sqlite3 STATIC ${SQLITE3_SOURCES})
add_library(sqlite3 ${SQLITE3_SOURCES})
target_include_directories(sqlite3 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlite3)
set_property(TARGET sqlite3 PROPERTY POSITION_INDEPENDENT_CODE ON)
if (SQLITE3_ENABLE_MATH_FUNCTIONS)
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_MATH_FUNCTIONS)
endif (SQLITE3_ENABLE_MATH_FUNCTIONS)

add_library(sqlite3-shared SHARED ${SQLITE3_SOURCES})
if (SQLITE3_ENABLE_MATH_FUNCTIONS)
target_compile_definitions(sqlite3-shared PUBLIC SQLITE_ENABLE_MATH_FUNCTIONS)
endif (SQLITE3_ENABLE_MATH_FUNCTIONS)

set_target_properties(sqlite3-shared
PROPERTIES OUTPUT_NAME sqlite3)
target_include_directories(sqlite3-shared INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlite3)

if(SQLITE3_WITH_SHELL)
add_executable(sqlite3-bin ${SQLITE3_SHELL_SOURCES})
target_link_libraries(sqlite3-bin sqlite3)
Expand All @@ -95,5 +85,4 @@ install(TARGETS sqlite3
INCLUDES DESTINATION include
)
export(TARGETS sqlite3 FILE sqlite3.cmake)
export(TARGETS sqlite3-shared FILE sqlite3-shared.cmake)
export(PACKAGE sqlite3)
Loading